File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update Version File After Release
2+
3+ on :
4+ release :
5+ types : [published]
6+ workflow_dispatch :
7+
8+ permissions :
9+ contents : write
10+ pull-requests : write
11+
12+ jobs :
13+ update-version :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+
19+ - name : Get version
20+ id : get_version
21+ run : |
22+ if [ "${{ github.event_name }}" = "release" ]; then
23+ echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
24+ else
25+ latest_tag=$(gh release list --limit 1 --json tagName -q '.[0].tagName')
26+ echo "VERSION=${latest_tag}" >> $GITHUB_ENV
27+ env :
28+ GH_TOKEN : ${{ github.token }}
29+
30+ - name : Write version to version.txt
31+ run : echo "${VERSION}" > version.txt
32+
33+ - name : Create PR for version.txt update
34+ id : cpr
35+ uses : peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
36+ with :
37+ commit-message : " Update version.txt to ${VERSION}"
38+ branch : update-version-txt-${{ github.run_id }}
39+ title : " Update version.txt to ${VERSION}"
40+ body : " This PR updates version.txt to the latest release version (${VERSION})."
41+ labels : " automation, version-update"
You can’t perform that action at this time.
0 commit comments