77 description : ' Branch or commit SHA to deploy'
88 required : false
99 type : string
10+ default : ' master'
1011 skipDeploy :
1112 description : ' Skip deployment to ECS'
1213 required : false
@@ -23,29 +24,31 @@ jobs:
2324 runs-on : ubuntu-latest
2425
2526 env :
26- SELECTED_REF : ${{ inputs.branchOrCommit != '' && inputs.branchOrCommit || github.sha }}
2727 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28- TAG_PREFIX : prod-
2928
3029 steps :
3130 - name : Checkout prod branch
3231 uses : actions/checkout@v4
3332 with :
34- ref : ${{ env.SELECTED_REF }}
33+ ref : ${{ inputs.branchOrCommit }}
34+
35+ - name : Get checked out commit SHA
36+ id : commit
37+ run : echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
3538
3639 - name : Create and push new date-based tag
3740 run : |
38- echo ${{ env.SELECTED_REF }}
41+ echo ${{ steps.commit.outputs.sha }}
3942 export TZ="America/New_York"
4043 tag_name="deploy-$(date +"%Y-%m-%d_%H-%M-%S")"
4144 git config user.name "github-actions"
4245 git config user.email "github-actions@github.com"
43- git tag "$tag_name" ${{ env.SELECTED_REF }}
46+ git tag "$tag_name" ${{ steps.commit.outputs.sha }}
4447 git push origin "$tag_name"
4548
4649 - name : Trigger Workflow 1
4750 run : |
4851 gh workflow run deploytest.yml \
4952 --ref master \
5053 --field skipDeploy=${{ inputs.skipDeploy }} \
51- --field branchOrCommit=${{ env.SELECTED_REF }}
54+ --field branchOrCommit=${{ steps.commit.outputs.sha }}
0 commit comments