remote_dispatch #226
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: start release | |
on: | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
type: boolean | |
description: 'プレリリース' | |
manual_preparation: | |
type: boolean | |
description: '前リリースタグとの合流を手動で行う' | |
repository_dispatch: | |
types: [remote_dispatch] | |
jobs: | |
start_release: | |
runs-on: ubuntu-latest | |
env: | |
RESULT_PATH: /tmp/result.txt | |
IS_PRERELEASE: ${{ github.event.inputs.prerelease == 'true' }} | |
NO_BRANCH_PREPARATION: ${{ github.event.inputs.manual_preparation == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
- name: git config | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
- name: prepare release | |
if: ${{ env.NO_BRANCH_PREPARATION == 'false' }} | |
run: | | |
BASE_TAG=v$(cat ./packages/smarthr-ui/package.json | grep "\"version\"" | cut -d "\"" -f 4) | |
git checkout $BASE_TAG | |
git merge --no-edit ${{ github.ref }} | |
- run: pnpm ui install | |
- name: release dry run | |
if: ${{ env.IS_PRERELEASE == 'false' }} | |
run: pnpm ui release:dryrun > ${{ env.RESULT_PATH }} | |
- name: prerelease dry run | |
if: ${{ env.IS_PRERELEASE == 'true' }} | |
run: pnpm ui release:dryrun --prerelease > ${{ env.RESULT_PATH }} | |
- name: wrap dry run log | |
run: | | |
echo "Dry Run Log: | |
\`\`\` | |
$(cat ${{ env.RESULT_PATH }}) | |
\`\`\`" > ${{ env.RESULT_PATH }} | |
- name: push branch | |
run: | | |
git checkout -b release-candidate | |
git push origin release-candidate | |
- name: release issue labels | |
if: ${{ env.IS_PRERELEASE == 'false' }} | |
run: echo ISSUE_LABELS='release candidate' >> $GITHUB_ENV | |
- name: prerelease issue labels | |
if: ${{ env.IS_PRERELEASE == 'true' }} | |
run: echo ISSUE_LABELS='release candidate, prerelease' >> $GITHUB_ENV | |
- name: create issue | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
title: Release candidate | |
content-filepath: ${{ env.RESULT_PATH }} | |
labels: ${{ env.ISSUE_LABELS }} | |
- name: Send GitHub Action trigger data to Slack | |
if: ${{ github.event.client_payload.channel_id != null }} | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ github.event.client_payload.channel_id }} | |
payload: ${{ github.event.client_payload.say }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |