Skip to content

Commit

Permalink
aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Jan 22, 2024
1 parent 1dbc25e commit e59911f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-future.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions .github/workflows/build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down

0 comments on commit e59911f

Please sign in to comment.