Skip to content
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.

Commit

Permalink
ci: Fix issue with docker tags on release
Browse files Browse the repository at this point in the history
  • Loading branch information
btorresgil committed Jan 3, 2023
1 parent 873d466 commit 4a8d249
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,34 @@ jobs:

- name: Determine docker tags and labels
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# On a release, tag with 'latest' and semantic versions (eg v3.2.1, v3.2, and v3)
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=semver,pattern=v{{version}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
type=semver,pattern=v{{major}}.{{minor}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
type=semver,pattern=v{{major}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
type=semver,pattern=v{{version}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
- name: Set the version in app.conf
if: needs.release.result == 'success' && needs.release.outputs.new_release_published == 'true'
run: scripts/set-version.sh ${{ needs.release.outputs.new_release_version }} ${{ needs.release.outputs.new_release_channel }}

- name: Create docker version tag
id: versiontag
if: needs.release.result == 'success' && needs.release.outputs.new_release_published == 'true'
run: echo "versiontag=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.new_release_version }}" >> $GITHUB_OUTPUT

- name: Login to Container registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
file: demo/Dockerfile
push: true
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.versiontag.outputs.versiontag }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 4a8d249

Please sign in to comment.