|
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] |
82 | 35 | permissions:
|
83 | 36 | packages: write
|
84 | 37 |
|
@@ -114,15 +67,14 @@ jobs:
|
114 | 67 | with:
|
115 | 68 | file: lite/Dockerfile
|
116 | 69 | platforms: ${{ env.BUILD_PLATFORMS }}
|
117 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
| 70 | + tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest |
118 | 71 | labels: ${{ steps.meta.outputs.labels }}
|
119 |
| - push: false |
| 72 | + push: true |
120 | 73 |
|
121 | 74 | builder:
|
122 | 75 | name: App Builder
|
123 | 76 | 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, 'full/Dockerfile'))) |
| 77 | + needs: [mods_list, builder_lite] |
126 | 78 | permissions:
|
127 | 79 | packages: write
|
128 | 80 |
|
@@ -158,15 +110,14 @@ jobs:
|
158 | 110 | with:
|
159 | 111 | file: full/Dockerfile
|
160 | 112 | platforms: ${{ env.BUILD_PLATFORMS }}
|
161 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
| 113 | + tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest |
162 | 114 | labels: ${{ steps.meta.outputs.labels }}
|
163 |
| - push: false |
| 115 | + push: true |
164 | 116 |
|
165 | 117 | dev_tools:
|
166 | 118 | name: App Developer Tools
|
167 | 119 | runs-on: ubuntu-latest
|
168 |
| - needs: [mods_list, check_changelog, builder] |
169 |
| - 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'))) |
| 120 | + needs: [mods_list, builder] |
170 | 121 | permissions:
|
171 | 122 | packages: write
|
172 | 123 |
|
@@ -202,6 +153,6 @@ jobs:
|
202 | 153 | with:
|
203 | 154 | file: dev-tools/Dockerfile
|
204 | 155 | platforms: ${{ env.BUILD_PLATFORMS }}
|
205 |
| - tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }} |
| 156 | + tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest |
206 | 157 | labels: ${{ steps.meta.outputs.labels }}
|
207 |
| - push: false |
| 158 | + push: true |
0 commit comments