Skip to content

Commit 32d9bb8

Browse files
777arcMarc Lichtman
andauthored
Push image to prod ACR with unique tag (#238)
Co-authored-by: Marc Lichtman <[email protected]>
1 parent 51ca4e8 commit 32d9bb8

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/cicd.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Get Most Recent Tag
23+
id: most-recent-tag
24+
uses: "WyriHaximus/github-action-get-previous-tag@v1"
1925

2026
- name: Log in with Azure
2127
uses: azure/login@v1
@@ -35,25 +41,25 @@ jobs:
3541
- name: Run cibuild
3642
run: ./scripts/cibuild
3743

38-
- name: Get image tag
39-
id: get_image_tag
44+
- name: Publish Image
45+
id: publish_image
4046
run:
4147
case "${GITHUB_REF}" in
4248
*tags*)
4349
echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT ;
44-
echo "acr=pccomponents" >> $GITHUB_OUTPUT
50+
./scripts/cipublish --acr pccomponents --tag ${{tag}}
4551
;;
4652
*)
53+
echo "Publishing to pccomponentstest as latest" ;
4754
echo "tag=latest" >> $GITHUB_OUTPUT ;
48-
echo "acr=pccomponentstest" >> $GITHUB_OUTPUT
55+
./scripts/cipublish --acr pccomponentstest --tag latest ;
56+
echo "Also publishing to pccomponents ACR with unique tag" ;
57+
./scripts/cipublish --acr pccomponents --tag ${{ steps.most-recent-tag.outputs.tag }}.${{ github.run_number }}
4958
;;
5059
esac
5160

52-
- name: Publish images
53-
run: ./scripts/cipublish --acr ${{steps.get_image_tag.outputs.acr}} --tag ${{steps.get_image_tag.outputs.tag}}
54-
5561
outputs:
56-
image_tag: ${{ steps.get_image_tag.outputs.tag }}
62+
image_tag: ${{ steps.publish_image.outputs.tag }}
5763

5864
deploy:
5965
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)