-
Notifications
You must be signed in to change notification settings - Fork 141
77 lines (75 loc) · 2.7 KB
/
startRelease.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: ${{ github.event.client_payload.say }}