11name : Bump Action version
22
33on :
4- push :
4+ workflow_run :
5+ workflows : ["Publish Release Tag"]
6+ types :
7+ - completed
58 branches :
69 - main
710 workflow_dispatch :
@@ -16,22 +19,24 @@ jobs:
1619 with :
1720 fetch-depth : 0
1821
19- - name : Update dirty-waters-action version
22+ - name : Get latest tag from this repository
23+ id : get-latest-tag
2024 run : |
21- COMMIT_SHA=$(git rev-parse HEAD)
25+ LATEST_TAG=$(git describe --tags --abbrev=0)
26+ echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
2227
23- # Use sed to update occurrences of the version in the workflow file
24- sed -i "s/chains-project\/dirty-waters-action@v[0-9.]\+/chains-project\/dirty-waters-action@${COMMIT_SHA}/g" ./example_workflow.yml
25-
26- echo "commit_sha=$COMMIT_SHA" >> $GITHUB_ENV
28+ - name : Update dirty-waters-action version to latest tag
29+ run : |
30+ # Use sed to update occurrences of the version in the workflow file with latest tag
31+ sed -i "s/chains-project\/dirty-waters-action@[a-z0-9]\+/chains-project\/dirty-waters-action@${{ env.LATEST_TAG }}/g" ./example_workflow.yml
2732
2833 - name : Update dirty_waters_version in the action to the repo's latest tag
2934 run : |
30- LATEST_TAG =$(git ls-remote --tags https://github.com/chains-project/dirty-waters.git | awk -F/ '{print $3}' | sort -V | tail -n1)
31- sed -i "s/DIRTY_WATERS_VERSION=\".*\"/DIRTY_WATERS_VERSION=\"$LATEST_TAG \"/" action.yml
35+ LATEST_DIRTY_WATERS_TAG =$(git ls-remote --tags https://github.com/chains-project/dirty-waters.git | awk -F/ '{print $3}' | sort -V | tail -n1)
36+ sed -i "s/DIRTY_WATERS_VERSION=\".*\"/DIRTY_WATERS_VERSION=\"$LATEST_DIRTY_WATERS_TAG \"/" action.yml
3237
3338 - name : Commit changes
3439 uses : stefanzweifel/git-auto-commit-action@v5.1.0
3540 with :
36- commit_message : " Bump dirty-waters-action version to ${{ env.commit_sha }}"
41+ commit_message : " Bump dirty-waters-action version to ${{ env.LATEST_TAG }}"
3742 branch : ${{ github.head_ref }}
0 commit comments