Release candidate #134
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: publish release | |
on: | |
issues: | |
types: | |
- labeled | |
jobs: | |
publish_release: | |
if: github.event.issue.state == 'open' && contains(github.event.issue.labels.*.name, 'release candidate') && github.event.label.name == 'approve release' | |
runs-on: ubuntu-latest | |
env: | |
CHANGELOG_PATH: /tmp/CHANGELOG.md | |
IS_PRERELEASE: ${{ contains(github.event.issue.labels.*.name, 'prerelease') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: release-candidate | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
registry-url: 'https://registry.npmjs.org' | |
- name: git config | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
- run: yarn install --frozen-lockfile | |
- run: yarn release | |
if: ${{ env.IS_PRERELEASE == 'false' }} | |
- run: yarn release --prerelease | |
if: ${{ env.IS_PRERELEASE == 'true' }} | |
- run: npm publish | |
if: ${{ env.IS_PRERELEASE == 'false' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: npm publish --tag prerelease | |
if: ${{ env.IS_PRERELEASE == 'true' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: echo NEW_TAG=$(git describe) >> $GITHUB_ENV | |
- run: git push origin $NEW_TAG | |
- run: npx ts-node ./scripts/getLatestChangelog.ts > ${{ env.CHANGELOG_PATH }} | |
- name: create release on GitHub | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.NEW_TAG }} | |
release_name: ${{ env.NEW_TAG }} | |
body_path: ${{ env.CHANGELOG_PATH }} | |
commitish: master | |
prerelease: ${{ env.IS_PRERELEASE }} | |
- name: close issue | |
uses: peter-evans/close-issue@v3 | |
- name: delete branch | |
run: git push origin :release-candidate | |
- name: cherry-pick release commit | |
run: | | |
git checkout master | |
git cherry-pick $NEW_TAG | |
- name: craete pull request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
title: 'chore(release): ${{ env.NEW_TAG }}' | |
branch: 'merge-release-${{ env.NEW_TAG }}' |