File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 77 version :
88 required : false
99 type : string
10+ commit_sha :
11+ required : false
12+ type : string
1013
1114env :
1215 ECR_REPOSITORY : " filplus-provider-benchmark"
2023 steps :
2124 - name : Checkout code
2225 uses : actions/checkout@v4
26+ with :
27+ ref : ${{ inputs.commit_sha }}
2328
2429 - name : Set up Docker Buildx
2530 uses : docker/setup-buildx-action@v3
Original file line number Diff line number Diff line change 1010 workflow_dispatch :
1111 inputs :
1212 version :
13- description : ' Enter the version number'
13+ description : " Enter the version number"
1414 required : true
15- default : ' latest'
15+ default : " latest"
1616
1717permissions :
1818 contents : write
2626 runs-on : ubuntu-latest
2727 needs : code-check
2828 if : ${{ github.ref_name == 'main' && inputs.version != '' }}
29+ outputs :
30+ commit_sha : ${{ steps.commit-version.outputs.commit_sha }}
2931
3032 steps :
3133 - name : Checkout code
4648 git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
4749
4850 - name : Commit version change
51+ id : commit-version
4952 run : |
5053 git commit -am "Update version to ${{ inputs.version }}"
5154 git push origin main
55+ echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
5256
5357 build-and-publish :
5458 needs :
@@ -61,11 +65,14 @@ jobs:
6165 uses : ./.github/workflows/build-docker-image.yml
6266 with :
6367 version : ${{ inputs.version }}
68+ commit_sha : ${{ github.ref_name == 'main' && inputs.version != '' && needs.bump-version.outputs.commit_sha || '' }}
6469 secrets : inherit
6570
6671 git-tag :
6772 runs-on : ubuntu-latest
68- needs : build-and-publish
73+ needs :
74+ - bump-version
75+ - build-and-publish
6976 if : |
7077 ${{ github.ref_name == 'main' && inputs.version != '' }} &&
7178 always() &&
@@ -74,10 +81,11 @@ jobs:
7481 steps :
7582 - name : Checkout code
7683 uses : actions/checkout@v4
84+ with :
85+ ref : ${{ needs.bump-version.outputs.commit_sha }}
7786
7887 - name : Create and push tag
7988 run : |
8089 TAG_NAME="v${{ inputs.version }}"
8190 git tag $TAG_NAME
8291 git push origin $TAG_NAME
83-
You can’t perform that action at this time.
0 commit comments