diff --git a/.github/workflows/build-future.yml b/.github/workflows/build-future.yml index 2057ade9..870811fc 100644 --- a/.github/workflows/build-future.yml +++ b/.github/workflows/build-future.yml @@ -72,4 +72,5 @@ jobs: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} with: tag: ${{ inputs.tag-prefix }}future + tag-alias: future images: ${{ needs.amd64.outputs.image }} ${{ needs.arm64.outputs.image }} diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml index f4f23ef5..e8995433 100644 --- a/.github/workflows/build-latest.yml +++ b/.github/workflows/build-latest.yml @@ -77,4 +77,5 @@ jobs: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} with: tag: ${{ inputs.tag-prefix }}latest + tag-alias: latest images: ${{ needs.amd64.outputs.image }} ${{ needs.arm64.outputs.image }} diff --git a/.github/workflows/build-testing.yml b/.github/workflows/build-testing.yml index c763a6e8..4b50eaff 100644 --- a/.github/workflows/build-testing.yml +++ b/.github/workflows/build-testing.yml @@ -80,4 +80,5 @@ jobs: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} with: tag: ${{ inputs.tag-prefix }}testing + tag-alias: testing images: ${{ needs.amd64.outputs.image }} ${{ needs.arm64.outputs.image }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3aef954b..296c90eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,13 +27,12 @@ jobs: setup: runs-on: ubuntu-latest outputs: - tag-prefix: ${{ steps.release.outputs.tag-prefix }} + tag-prefix: ${{ steps.tag-prefix.outputs.tag-prefix }} steps: - uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} - - id: release - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + - id: tag-prefix run: count="$(git rev-list HEAD --count --first-parent)" echo "tag-prefix=v${count}-" >> $GITHUB_OUTPUT diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 7bfbca7a..34484d11 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -10,6 +10,10 @@ on: description: 'Tag to use as the manifest list image name' type: 'string' required: true + tag-alias: + description: 'Tag to alias to the tag of the manifest, e.g. "latest"' + type: 'string' + required: true images: description: 'Space separated list of images to include in the manifest list' type: 'string' @@ -22,6 +26,7 @@ on: env: HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} IMAGE: ${{ format('{0}/{1}:{2}', secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io', github.repository, github.event_name == 'pull_request' && format('pr-{0}-{1}', github.event.pull_request.number, inputs.tag) || inputs.tag) }} + IMAGE_ALIAS: ${{ format('{0}/{1}:{2}', secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io', github.repository, github.event_name == 'pull_request' && format('pr-{0}-{1}', github.event.pull_request.number, inputs.tag-alias) || inputs.tag-alias) }} REGISTRY: ${{ secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io' }} jobs: @@ -53,6 +58,8 @@ jobs: docker manifest create ${{ env.IMAGE }} ${{ inputs.images }} - run: | docker manifest push ${{ env.IMAGE }} + - run: | + docker buildx imagetools create -t ${{ env.IMAGE_ALIAS }} ${{ env.IMAGE }} - uses: actions/github-script@v5 with: script: |