feat: add 是什么歌.com #227
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: Dispatch New Release | |
on: | |
# trigger on push to main branch | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'supabase/**' | |
- 'README.md' | |
- 'scripts/**' | |
- 'packages/self-hosted-functions/**' | |
concurrency: | |
group: release-dispatcher-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tagger: | |
# if the push commit message contains [skip ci], skip ci | |
if: contains(github.event.commits[0].message, '[skip ci]') == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "main" | |
# git tag the release, then push it | |
# The tag name is `v` followed by a semver version number, in which is calculated by incrementing the patch | |
# version of the latest tag. If no tag exists, the version is 0.0.1 | |
- name: Tag Release | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.PAT_FOR_RELEASE_DISPATCHER }} | |
script: | | |
const { data: tags } = await github.rest.repos.listTags({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
const latestTag = tags[0]; | |
const latestVersion = latestTag ? latestTag.name.replace("v", "") : "0.0.0"; | |
const [major, minor, patch] = latestVersion.split(".").map((v) => parseInt(v)); | |
const newVersion = `${major}.${minor}.${patch + 1}`; | |
const newTag = `v${newVersion}`; | |
await github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${newTag}`, | |
sha: context.sha, | |
}); | |
console.log(`Created tag ${newTag}`); |