Skip to content

Commit

Permalink
Update ci-push-tag-gar.yml - IMAGE_TAG with GITHUB_SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu-benoit authored Jul 14, 2023
1 parent eb6a2b3 commit 9ac5e9a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/ci-push-tag-gar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
version: latest
- name: prepare environment variables
run: |
shortSha=`echo ${GITHUB_SHA} | cut -c1-7`
echo "IMAGE_TAG=$shortSha" >> $GITHUB_ENV
imageName=${{ secrets.REGISTRY_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REGISTRY_NAME }}/my-sample-app
echo "IMAGE_NAME=$imageName" >> $GITHUB_ENV
- name: sign-in to artifact registry
Expand All @@ -29,9 +31,12 @@ jobs:
- name: build the container
run: |
docker build \
--tag ${IMAGE_NAME}:latest \
--tag ${IMAGE_NAME}:${IMAGE_TAG} \
app/
- name: push the container to GAR
run: |
docker push \
${IMAGE_NAME}:${IMAGE_TAG}
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest
docker push \
${IMAGE_NAME}:latest

0 comments on commit 9ac5e9a

Please sign in to comment.