Skip to content

Commit

Permalink
Use the released tag version to identify newly-created docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Oct 17, 2024
1 parent f29d065 commit 57f159a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '*'

env:
DOCKER_IMAGE_URL: ${{ vars.REPO_DOCKER_IMAGE_URL }}:${{ github.sha }}
DOCKER_IMAGE_URL: ${{ vars.REPO_DOCKER_IMAGE_URL }}

jobs:
build:
Expand All @@ -20,6 +20,10 @@ jobs:
fetch-depth: 0
fetch-tags: true

- name: Set Gateway Version
id: set_version
run: echo "GATEWAY_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')" >> $GITHUB_OUTPUT

- name: Google auth
id: auth
uses: google-github-actions/auth@v2
Expand All @@ -36,5 +40,5 @@ jobs:
- name: Docker Auth
run: |-
gcloud auth configure-docker ${{ vars.GAR_LOCATION }}-docker.pkg.dev
docker build -t ${{ env.DOCKER_IMAGE_URL }} --build-arg GATEWAY_VERSION=$(git describe --tags --abbrev=0 2>/dev/null) --file Dockerfile .
docker push ${{ env.DOCKER_IMAGE_URL }}
docker build -t ${{ env.DOCKER_IMAGE_URL }}:${{ steps.set_version.outputs.GATEWAY_VERSION }} --build-arg GATEWAY_VERSION=${{ steps.set_version.outputs.GATEWAY_VERSION }} --file Dockerfile .
docker push ${{ env.DOCKER_IMAGE_URL }}:${{ steps.set_version.outputs.GATEWAY_VERSION }}

0 comments on commit 57f159a

Please sign in to comment.