@@ -39,20 +39,39 @@ runs:
39
39
username : ${{ inputs.username }}
40
40
password : ${{ inputs.password }}
41
41
42
- # Determine the tags for the image
42
+ - name : Docker Tag
43
+ id : tag
44
+ shell : bash
45
+ run : |
46
+ function export_tag() {
47
+ echo "tag=$1" >> $GITHUB_OUTPUT
48
+ exit 0
49
+ }
50
+
51
+ if [[ ${{ github.event_name }} == 'pull_request' ]]; then
52
+ export_tag "type=ref,event=pr"
53
+ elif [[ ${{ github.event_name }} == 'merge_group' ]]; then
54
+ export_tag "type=raw,value=staging"
55
+ elif [[ ${{ github.event_name }} == 'push' ]]; then
56
+ if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
57
+ export_tag "type=raw,value=latest"
58
+ else
59
+ export_tag "type=sha"
60
+ fi
61
+ fi
62
+
63
+ echo "No tag found, exiting."
64
+ echo "event_name: ${{ github.event_name }}"
65
+ echo "ref: ${{ github.ref }}"
66
+
67
+ exit 1
68
+
43
69
- name : Docker meta
44
70
id : meta
45
71
uses : docker/metadata-action@v5
46
72
with :
47
- # Hard coding our dockerhub imnage name
48
73
images : ghcr.io/mozilla/test-github-features
49
- tags : |
50
- type=schedule
51
- type=ref,event=tag
52
- type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
53
- type=ref,event=pr
54
- type=raw,value=latest,enable={{is_default_branch}}
55
- type=raw,value=staging,enable=${{ contains(github.event.head_ref, 'gh-readonly-queue/main') }}
74
+ tags : ${{ steps.tag.outputs.tag }}
56
75
57
76
- name : Build Image
58
77
uses : docker/build-push-action@v5
0 commit comments