|
22 | 22 | url: https://hub.docker.com/r/danielflook/terraform-github-actions/tags?name=${{ github.event.release.tag_name }} |
23 | 23 | outputs: |
24 | 24 | digest: ${{ steps.image_build.outputs.digest }} |
| 25 | + base-digest: ${{ steps.image_build.outputs.base-digest }} |
25 | 26 | steps: |
26 | 27 | - name: Checkout |
27 | 28 | uses: actions/checkout@v4 |
@@ -74,12 +75,14 @@ jobs: |
74 | 75 | --annotation "index,manifest:builder-id=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ |
75 | 76 | --annotation "index,manifest:ref.tag=$RELEASE_TAG" \ |
76 | 77 | --annotation "index,manifest:org.opencontainers.image.base.name=docker.io/danielflook/terraform-github-actions-base" \ |
| 78 | + --annotation "index,manifest:base.manifest.digest=$BASE_DIGEST" \ |
77 | 79 | --annotation "index:org.opencontainers.image.base.ref=$BASE_TAG" \ |
78 | 80 | --push \ |
79 | 81 | --iidfile manifest-list-digest.txt \ |
80 | 82 | image |
81 | 83 |
|
82 | 84 | echo "digest=$(<manifest-list-digest.txt)" >> "$GITHUB_OUTPUT" |
| 85 | + echo "base-digest=$BASE_DIGEST" >> "$GITHUB_OUTPUT" |
83 | 86 |
|
84 | 87 | - name: Dockerhub ref attestation |
85 | 88 | uses: actions/attest-build-provenance@v2 |
@@ -184,3 +187,35 @@ jobs: |
184 | 187 | echo "Skipping dflook/$action" |
185 | 188 | fi |
186 | 189 | done |
| 190 | +
|
| 191 | + tag-base-image: |
| 192 | + runs-on: ubuntu-24.04 |
| 193 | + name: Tag base image with release version |
| 194 | + needs: |
| 195 | + - image |
| 196 | + - actions |
| 197 | + permissions: |
| 198 | + contents: read |
| 199 | + packages: write |
| 200 | + environment: |
| 201 | + name: dockerhub |
| 202 | + url: https://hub.docker.com/r/danielflook/terraform-github-actions-base/tags?name=${{ github.event.release.tag_name }} |
| 203 | + steps: |
| 204 | + - name: Registry login |
| 205 | + env: |
| 206 | + DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} |
| 207 | + run: | |
| 208 | + echo "$DOCKER_TOKEN" | docker login --username danielflook --password-stdin |
| 209 | +
|
| 210 | + - name: Set up Docker Buildx |
| 211 | + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 |
| 212 | + |
| 213 | + - name: Tag and push base image with release version |
| 214 | + env: |
| 215 | + RELEASE_TAG: "${{ github.event.release.tag_name }}" |
| 216 | + BASE_DIGEST: ${{ needs.image.outputs.base-digest }} |
| 217 | + run: | |
| 218 | + # Tag the base image manifest list with the release version |
| 219 | + docker buildx imagetools create \ |
| 220 | + --tag "danielflook/terraform-github-actions-base:$RELEASE_TAG" \ |
| 221 | + "danielflook/terraform-github-actions-base@$BASE_DIGEST" |
0 commit comments