Release candidate #188
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]" | |
- name: pnpm install | |
run: | | |
corepack enable | |
corepack prepare | |
pnpm ui install | |
- run: pnpm ui release | |
if: ${{ env.IS_PRERELEASE == 'false' }} | |
- run: pnpm ui release --prerelease | |
if: ${{ env.IS_PRERELEASE == 'true' }} | |
- run: pnpm publish --filter smarthr-ui --no-git-checks | |
if: ${{ env.IS_PRERELEASE == 'false' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: pnpm publish --filter smarthr-ui --tag prerelease --no-git-checks | |
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 ./packages/smarthr-ui/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: create pull request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
title: 'chore(release): ${{ env.NEW_TAG }}' | |
branch: 'merge-release-${{ env.NEW_TAG }}' | |
labels: release candidate | |
- name: Send message to Slack | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"text": "<!subteam^S01RJL6PHJ8> npm publish が完了しました。Release Pull Request を手動でマージしたらリリース完了です。" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |