Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linebot/version.go forcibly when release is published #386

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
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 [email protected]

- 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