File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update Version and Release
2+ on :
3+ push :
4+ branches :
5+ - main
6+
7+ permissions :
8+ contents : write
9+
10+ jobs :
11+ update-version :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v2
15+
16+ - name : Extract latest version from CHANGELOG.md
17+ id : get_version
18+ run : |
19+ VERSION=$(grep -oP '\[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md | head -1)
20+ echo "::set-output name=VERSION::$VERSION"
21+
22+ - name : Update version in cmd/api/main.go
23+ run : |
24+ sed -i "s/var version = \".*\"/var version = \"${{ steps.get_version.outputs.VERSION }}\"/" cmd/api/main.go
25+
26+ - name : Commit and push if changed
27+ run : |
28+ git config --global user.email "[email protected] " 29+ git config --global user.name "GitHub Action"
30+ git add cmd/api/main.go
31+ git commit -m "Update version to ${{ steps.get_version.outputs.VERSION }}" || echo "No changes to commit"
32+ git push
You can’t perform that action at this time.
0 commit comments