-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update linebot/version.go forcibly when release is publised (#386)
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: On Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
update-version-file: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Install gobump | ||
run: go install github.com/x-motemen/gobump/cmd/gobump@latest | ||
|
||
- name: Echo the release tag | ||
run: | | ||
echo "The release tag is: ${{ github.event.release.tag_name }}" | ||
- name: Checkout master branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'master' | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
- name: Commit and push linebot/version.go to master | ||
run: | | ||
VERSION=${{ github.event.release.tag_name }} | ||
VERSION=${VERSION#v} | ||
gobump set $VERSION -w -v linebot | ||
git add linebot/version.go | ||
git commit -m "Update version.go with tag information for ${{ github.event.release.tag_name }}" | ||
git push | ||
- name: Get the latest commit SHA | ||
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Force tag update to the latest commit | ||
run: | | ||
git tag -fa ${{ github.event.release.tag_name }} -m "Update tag for ${{ github.event.release.tag_name }}" ${{ env.sha }} | ||
git push origin ${{ github.event.release.tag_name }} --force |