🚀 After the release is successful #67
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: 🚀 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' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Git bootstrap | |
run: | | |
git config --global user.name 'Jinke Li' | |
git config --global user.email '[email protected]' | |
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: 🔊 Delpoy start notify | |
uses: zcong1993/actions-ding@master | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
ignoreError: true | |
body: | | |
{ | |
"msgtype": "link", | |
"link": { | |
"title": "📢 开始自动部署旧版官网(https://s2.antv.vision) 📢 ", | |
"text": "🔗 请点击链接查看详情", | |
"messageUrl": "https://github.com/antvis/S2/actions/workflows/release-success.yml", | |
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*gt5-RZDjt3IAAAAAAAAAAAAADmJ7AQ/original" | |
} | |
} | |
# 安装官网依赖 | |
- name: Install Dependencies | |
run: yarn site:bootstrap | |
# 部署官网 | |
- name: Delpoy Site | |
run: yarn site:deploy | |
# 失败通知 | |
- name: 🔊 Delpoy failed notify | |
if: ${{ failure() }} | |
uses: zcong1993/actions-ding@master | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
ignoreError: true | |
body: | | |
{ | |
"msgtype": "link", | |
"link": { | |
"title": "🚨 旧版官网部署失败", | |
"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" | |
} | |
} |