-
Notifications
You must be signed in to change notification settings - Fork 4
96 lines (96 loc) · 3.95 KB
/
Copy pathcreate-release-branch.yml
File metadata and controls
96 lines (96 loc) · 3.95 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: "Create release branch"
on:
workflow_dispatch: # Should be executed manually.
jobs:
create-release:
runs-on: ubuntu-latest
timeout-minutes: 20
# Should be executed on the dev repo.
if: github.repository != 'plaidev/karte-react-native'
permissions:
contents: write
steps:
- name: Generate GitHub App token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
# TODO: app-id is deprecated in v3.1.0, rename to client-id
app-id: ${{ secrets.APP_TEAM_GITHUB_APP_ID }}
private-key: ${{ secrets.APP_TEAM_GITHUB_APP_PRIVATE_KEY }}
owner: plaidev
repositories: |
karte-react-native-dev
karte-react-native-tools
- name: Checkout develop
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: develop
- name: Configure Git
run: |
git config user.email "git@users.noreply.github.com"
git config user.name "github actions"
git fetch
- name: Get current date
id: date
run: echo "date=$(date +'%Y.%m.%dT%H.%M.%S')" >> $GITHUB_OUTPUT
- name: Create release branch
run: |
git checkout -b release/${{ steps.date.outputs.date }}
- name: Update CHANGELOG.md
run: |
sed -i "0,/# Releases - xxxx.xx.xx/ s/# Releases - xxxx.xx.xx/# Releases - $(date '+%Y.%m.%d')/" ./CHANGELOG.md
git add ./CHANGELOG.md
git commit -m "Update CHANGELOG.md"
- name: Push release branch
run: |
git push origin -u release/${{ steps.date.outputs.date }}
- name: Create Pull Request
id: create_pr
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR_BODY: |
### 以下の項目を確認してください
- [ ] 各パッケージの`package.json`内のバージョンが更新されていることを確認した。
- [ ] `CHANGELOG.md`が更新されていることを確認した。
- [ ] サンプルアプリで動作確認を行った。
- [ ] 全てのチェックボックスを埋めると自動的にマージ作業を開始します。
run: |
PR_URL=$(gh pr create \
--title "Release by ${{ github.actor }}" \
--body "$PR_BODY" \
--base master \
--head release/${{ steps.date.outputs.date }})
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
- name: Trigger deploy-test-expo-app (iOS)
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh workflow run deploy-test-expo-app-ios.yml \
--repo plaidev/karte-react-native-tools \
--field sdk_branch=release/${{ steps.date.outputs.date }} \
--field expo_plugin_branch=main
- name: Trigger deploy-test-expo-app (Android)
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh workflow run deploy-test-expo-app-android.yml \
--repo plaidev/karte-react-native-tools \
--field sdk_branch=release/${{ steps.date.outputs.date }} \
--field expo_plugin_branch=main
- name: Notify Slack on success
if: success()
uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_MESSAGE: |
✅ Successfully created release branch
PR: ${{ steps.create_pr.outputs.pr_url }}
SLACK_COLOR: success
- name: Notify Slack on failure
if: failure()
uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_MESSAGE: |
❌ Failed to create release branch
SLACK_COLOR: failure