-
Notifications
You must be signed in to change notification settings - Fork 196
74 lines (65 loc) · 2.59 KB
/
release-success.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
name: 🚀 After the release is successful
# 自动发布 action 执行完成后再执行 (无论成功失败都会执行)
on:
workflow_run:
workflows: ["🚀 Auto Release"]
branches: [latest] # 只有正式版发布才同步 changelog
types:
- completed
jobs:
sync-site-lock:
runs-on: ubuntu-latest
# 自动发布成功后
if: github.event.workflow_run.conclusion == 'success'
defaults:
run:
working-directory: s2-site
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Git bootstrap
run: |
git config --global user.name 'Jinke Li'
git config --global user.email 'a1231236677287@163.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.JINKE_GITHUB_TOKEN }}
- name: Checkout branch
run: |
git checkout -b chore-sync
git fetch --all
git merge origin/latest --squash
- name: Push lock
run: |
git add .
git commit -m "chore: 🤖 更新 changelog 文件" -n
git push origin chore-sync --no-verify -f
# 使用官方的 github cli 便捷的创建 pr
- name: Create PR
run: |
gh pr create --title "chore: 🤖 更新 changelog 文件" --body "![preview](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*Eel8Rp5jlAkAAAAAAAAAAAAADmJ7AQ/original) <br/> 🤖 由 [[🚀 After the release is successful](https://github.com/antvis/S2/blob/master/.github/workflows/release-success.yml)] action 自动创建."
env:
GITHUB_TOKEN: ${{ secrets.JINKE_GITHUB_TOKEN }}
# 失败通知
- name: 🔊 Create failed notify
if: ${{ failure() }}
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
ignoreError: true
body: |
{
"msgtype": "link",
"link": {
"title": "🚨 同步 CHANGELOG 失败",
"text": "🔗 请点击链接查看具体原因, 尝试点击右上角 [Re-run all jobs] 重试 🚑",
"messageUrl": "https://github.com/antvis/S2/actions/workflows/release-success.yml",
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*PRSkSqsE_vYAAAAAAAAAAAAADmJ7AQ/original"
}
}