Skip to content

Commit

Permalink
fix: update release workflow to ensure every docker tag is pushed (co…
Browse files Browse the repository at this point in the history
  • Loading branch information
codfish authored Jun 17, 2024
1 parent ac1b7f3 commit 9a999e0
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,31 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: docker login
- name: Docker login
run: |
echo "$GCR_TOKEN" | docker login ghcr.io -u codfish --password-stdin
env:
GCR_TOKEN: ${{ secrets.GCR_TOKEN }}

# Step to create a list of tags to push to GCR always including the latest tag and optionally
# the new release tag and major release tag.
- name: Create tags list
id: tags
shell: bash
run: |
TAGS="ghcr.io/codfish/semantic-release-action:latest"
if [ "${{ steps.semantic.outputs.new-release-published }}" == "true" ]; then
TAGS="${TAGS},ghcr.io/codfish/semantic-release-action:v${{ steps.semantic.outputs.release-version }}"
TAGS="${TAGS},ghcr.io/codfish/semantic-release-action:v${{ steps.semantic.outputs.release-major }}"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
# Push docker images to GCR
# Dockerhub is auto synced with the repo, no need to explicitly deploy
- name: build and push latest docker image to GCR
- name: Build and push docker images to GCR
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64,linux/amd64
push: true
tags: ghcr.io/codfish/semantic-release-action:latest

- name: push docker images for releases to GCR
if: steps.semantic.outputs.new-release-published == 'true'
run: |
docker tag ghcr.io/codfish/semantic-release-action ghcr.io/codfish/semantic-release-action:$VERSION_TAG
docker tag ghcr.io/codfish/semantic-release-action ghcr.io/codfish/semantic-release-action:$MAJOR_TAG
docker push ghcr.io/codfish/semantic-release-action:$VERSION_TAG
docker push ghcr.io/codfish/semantic-release-action:$MAJOR_TAG
env:
VERSION_TAG: v${{ steps.semantic.outputs.release-version }}
MAJOR_TAG: v${{ steps.semantic.outputs.release-major }}
tags: ${{ steps.tags.outputs.tags }}

0 comments on commit 9a999e0

Please sign in to comment.