File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 55 - main
66 - stable
77 workflow_dispatch :
8+ schedule :
9+ - cron : " 0 0 10 * *"
810
911jobs :
1012 build-n-push :
2022 steps :
2123 - uses : actions/checkout@v3
2224
23- - name : Extract branch name and set tag
25+ - name : Extract branch name and set tag when triggered via push
26+ if : " !github.event.schedule"
2427 shell : bash
2528 run : |
2629 branch=${GITHUB_REF#refs/heads/}
@@ -33,10 +36,29 @@ jobs:
3336 tag="prod"
3437 ;;
3538 esac
39+ unique_tag="${branch}-${GITHUB_SHA::7}"
40+
3641 echo "branch=${branch}" >> $GITHUB_OUTPUT
42+ echo "tag=${tag} ${unique_tag}" >> $GITHUB_OUTPUT
43+
44+ id : branch_tag_push
45+
46+ - name : Extract branch name and set tags when triggered via schedule
47+ if : github.event.schedule
48+ shell : bash
49+ run : |
50+ # Do not rely on hard-coded `main`
51+ branch=${GITHUB_REF#refs/heads/}
52+
53+ # Set all tags during periodic rebuild
54+ tag="prod stg latest"
3755 unique_tag="${branch}-${GITHUB_SHA::7}"
56+
57+ # Propagate changes to outputs
58+ echo "branch=${branch}" >> $GITHUB_OUTPUT
3859 echo "tag=${tag} ${unique_tag}" >> $GITHUB_OUTPUT
39- id : branch_tag
60+
61+ id : branch_tag_schedule
4062
4163 - name : Build Image
4264 id : build-image
You can’t perform that action at this time.
0 commit comments