@@ -19,6 +19,12 @@ outputs:
1919 version :
2020 description : " The version for the image"
2121 value : ${{ steps.meta.outputs.version }}
22+ image :
23+ description : " The Docker image"
24+ value : ${{ steps.image.outputs.image }}
25+ image_version :
26+ description : " Combines image and version to a valid image tag"
27+ value : ${{ steps.image.outputs.image }}:${{ steps.meta.outputs.version }}
2228
2329runs :
2430 using : " composite"
@@ -42,39 +48,22 @@ runs:
4248 username : ${{ inputs.username }}
4349 password : ${{ inputs.password }}
4450
45- - name : Docker Tag
46- id : tag
51+ - name : Docker Image
52+ id : image
4753 shell : bash
4854 run : |
49- function export_tag() {
50- echo "tag=$1" >> $GITHUB_OUTPUT
51- exit 0
52- }
53-
54- if [[ ${{ github.event_name }} == 'pull_request' ]]; then
55- export_tag "type=ref,event=pr"
56- elif [[ ${{ github.event_name }} == 'merge_group' ]]; then
57- export_tag "type=raw,value=staging"
58- elif [[ ${{ github.event_name }} == 'push' ]]; then
59- if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
60- export_tag "type=raw,value=latest"
61- else
62- export_tag "type=sha"
63- fi
64- fi
65-
66- echo "No tag found, exiting."
67- echo "event_name: ${{ github.event_name }}"
68- echo "ref: ${{ github.ref }}"
69-
70- exit 1
55+ echo "image=ghcr.io/mozilla/test-github-features" >> $GITHUB_OUTPUT
7156
7257 - name : Docker meta
7358 id : meta
7459 uses : docker/metadata-action@v5
7560 with :
76- images : ghcr.io/mozilla/test-github-features
77- tags : ${{ steps.tag.outputs.tag }}
61+ images : ${{ steps.image.outputs.image }}
62+ tags : |
63+ type=raw,value=latest,enable={{is_default_branch}}
64+ type=raw,value=staging,enable=${{ github.event_name == 'merge_group' }}
65+ type=ref,event=pr
66+ type=sha
7867
7968 - name : Build Image
8069 uses : docker/build-push-action@v5
0 commit comments