chore: Bump python grammar (#751) #508
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
name: Bump Version | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- repos/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
bump-version: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: jcs090218/setup-emacs@master | |
with: | |
version: '27.2' | |
- uses: actions/checkout@v4 | |
- name: Bump version | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
let response = await github.rest.git.getCommit({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
commit_sha: context.sha | |
}); | |
console.log(response); | |
let commit = response.data; | |
let m = commit.message.match(/!bump-version(.*)$/m) | |
if (!!m && typeof m[1] == 'string') { | |
let next_version = m[1].trim(); | |
await exec.exec('script/dev', ['bump-version', next_version]); | |
} else { | |
await exec.exec('script/dev', ['bump-version']); | |
} | |
# We don't want this to trigger workflows, so we don't use a personal access token. | |
- name: Create the release commit | |
# TODO: Sign the tag? | |
run: | | |
git add --update | |
git config --global user.name 'Tuấn-Anh Nguyễn' | |
git config --global user.email '[email protected]' | |
RELEASE_VERSION=$(script/dev current-version) | |
git commit -m "Release $RELEASE_VERSION" | |
echo RELEASE_VERSION=$RELEASE_VERSION >> $GITHUB_ENV | |
echo RELEASE_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV | |
git push | |
- name: Create the release tag | |
uses: actions/github-script@v5 | |
with: | |
# Use personal access token to trigger the release workflow. | |
github-token: ${{ secrets.PAT }} | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ env.RELEASE_VERSION }}", | |
sha: "${{ env.RELEASE_SHA }}" | |
}) |