|
13 | 13 | BUILD_PLATFORMS: linux/amd64,linux/arm64
|
14 | 14 |
|
15 | 15 | jobs:
|
16 |
| - check_changelog: |
17 |
| - name: Check changelog versions |
18 |
| - runs-on: ubuntu-latest |
19 |
| - steps: |
20 |
| - - name: Clone |
21 |
| - uses: actions/checkout@v3 |
22 |
| - |
23 |
| - - name: Get current version |
24 |
| - id: get-current-version |
25 |
| - run: | |
26 |
| - echo "current_version=$(grep -Po '(?<=## \[)(\d+\.)+[^\]]' CHANGELOG.md | head -n 1)" >> "$GITHUB_OUTPUT" |
27 |
| -
|
28 |
| - - name: Login to registry |
29 |
| - uses: docker/login-action@v2 |
30 |
| - with: |
31 |
| - registry: ${{ env.REGISTRY }} |
32 |
| - username: ${{ github.actor }} |
33 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
34 |
| - |
35 |
| - - name: Check already existing image |
36 |
| - run: | |
37 |
| - GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) |
38 |
| -
|
39 |
| - # Get tags of all images from GHCR |
40 |
| - TAGS_FULL=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/${REPO_NAME,,}/tags/list) |
41 |
| - TAGS_LITE=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/${REPO_NAME,,}-lite/tags/list) |
42 |
| - TAGS_LEGACY=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/${REPO_NAME,,}-legacy/tags/list) |
43 |
| - TAGS_DEV_TOOLS=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/ledger-app-dev-tools/tags/list) |
44 |
| -
|
45 |
| - # Concatenate all tags from json fields in one string without brackets |
46 |
| - ALL_TAGS=$(echo $TAGS_FULL $TAGS_LITE $TAGS_LEGACY $TAGS_DEV_TOOLS | jq -s '.[0].tags + .[1].tags + .[2].tags + .[3].tags' | tr -d '[]') |
47 |
| -
|
48 |
| - # Get the tag to find |
49 |
| - TAG_TO_FIND=${{ steps.get-current-version.outputs.current_version }} |
50 |
| -
|
51 |
| - # Check if the tag to find is already present in the list of tags |
52 |
| - if [[ "$ALL_TAGS" == *"$TAG_TO_FIND"* ]]; then |
53 |
| - echo "An image tagged with the latest changelog version already exists on GHCR. Please update the changelog." |
54 |
| - exit 1 |
55 |
| - else |
56 |
| - exit 0 |
57 |
| - fi |
58 |
| - outputs: |
59 |
| - current_version: ${{ steps.get-current-version.outputs.current_version }} |
60 |
| - |
61 |
| - |
62 | 16 | mods_list:
|
63 | 17 | name: Get modified files
|
64 | 18 | runs-on: ubuntu-latest
|
|
77 | 31 | builder_lite:
|
78 | 32 | name: App Builder Lite
|
79 | 33 | runs-on: ubuntu-latest
|
80 |
| - needs: [mods_list, check_changelog] |
81 |
| - if: needs.check_changelog.result == 'success' && contains(needs.mods_list.outputs.modified_files, 'lite/Dockerfile') |
| 34 | + needs: [mods_list] |
| 35 | + if: contains(needs.mods_list.outputs.modified_files, 'lite/Dockerfile') |
82 | 36 | permissions:
|
83 | 37 | packages: write
|
84 | 38 |
|
@@ -114,52 +68,15 @@ jobs:
|
114 | 68 | with:
|
115 | 69 | file: lite/Dockerfile
|
116 | 70 | platforms: ${{ env.BUILD_PLATFORMS }}
|
117 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
118 |
| - labels: ${{ steps.meta.outputs.labels }} |
119 |
| - push: false |
120 |
| - |
121 |
| - builder_legacy: |
122 |
| - name: App Builder Legacy |
123 |
| - runs-on: ubuntu-latest |
124 |
| - needs: [mods_list, check_changelog, builder_lite] |
125 |
| - if: always() && needs.check_changelog.result == 'success' && (needs.builder_lite.result == 'success' || (needs.builder_lite.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'legacy/Dockerfile'))) |
126 |
| - permissions: |
127 |
| - packages: write |
128 |
| - |
129 |
| - steps: |
130 |
| - - name: Clone |
131 |
| - uses: actions/checkout@v3 |
132 |
| - |
133 |
| - - name: Login to registry |
134 |
| - uses: docker/login-action@v2 |
135 |
| - with: |
136 |
| - registry: ${{ env.REGISTRY }} |
137 |
| - username: ${{ github.actor }} |
138 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
139 |
| - |
140 |
| - - name: Make full image name |
141 |
| - run: | |
142 |
| - echo "IMAGE=${REGISTRY}/${REPO_PATH,,}/${REPO_NAME,,}-legacy" >>${GITHUB_ENV} |
143 |
| -
|
144 |
| - - name: Extract metadata |
145 |
| - id: meta |
146 |
| - uses: docker/metadata-action@v4 |
147 |
| - with: |
148 |
| - images: ${{ env.IMAGE }} |
149 |
| - |
150 |
| - - name: Build and push container |
151 |
| - uses: docker/build-push-action@v3 |
152 |
| - with: |
153 |
| - file: legacy/Dockerfile |
154 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
| 71 | + tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest |
155 | 72 | labels: ${{ steps.meta.outputs.labels }}
|
156 |
| - push: false |
| 73 | + push: true |
157 | 74 |
|
158 | 75 | builder:
|
159 | 76 | name: App Builder
|
160 | 77 | runs-on: ubuntu-latest
|
161 |
| - needs: [mods_list, check_changelog, builder_lite] |
162 |
| - if: always() && needs.check_changelog.result == 'success' && (needs.builder_lite.result == 'success' || (needs.builder_lite.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'full/Dockerfile'))) |
| 78 | + needs: [mods_list, builder_lite] |
| 79 | + if: always() (needs.builder_lite.result == 'success' || (needs.builder_lite.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'full/Dockerfile'))) |
163 | 80 | permissions:
|
164 | 81 | packages: write
|
165 | 82 |
|
@@ -195,15 +112,15 @@ jobs:
|
195 | 112 | with:
|
196 | 113 | file: full/Dockerfile
|
197 | 114 | platforms: ${{ env.BUILD_PLATFORMS }}
|
198 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
| 115 | + tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest |
199 | 116 | labels: ${{ steps.meta.outputs.labels }}
|
200 |
| - push: false |
| 117 | + push: true |
201 | 118 |
|
202 | 119 | dev_tools:
|
203 | 120 | name: App Developer Tools
|
204 | 121 | runs-on: ubuntu-latest
|
205 |
| - needs: [mods_list, check_changelog, builder] |
206 |
| - if: always() && needs.check_changelog.result == 'success' && (needs.builder.result == 'success' || (needs.builder.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'dev-tools/Dockerfile'))) |
| 122 | + needs: [mods_list, builder] |
| 123 | + if: always() && (needs.builder.result == 'success' || (needs.builder.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'dev-tools/Dockerfile'))) |
207 | 124 | permissions:
|
208 | 125 | packages: write
|
209 | 126 |
|
@@ -239,6 +156,6 @@ jobs:
|
239 | 156 | with:
|
240 | 157 | file: dev-tools/Dockerfile
|
241 | 158 | platforms: ${{ env.BUILD_PLATFORMS }}
|
242 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
| 159 | + tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest |
243 | 160 | labels: ${{ steps.meta.outputs.labels }}
|
244 |
| - push: false |
| 161 | + push: true |
0 commit comments