Merge branch 'master' into alpha #616
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: 🚀 Auto Release | |
on: | |
push: | |
branches: | |
- latest # 正式版 | |
- beta | |
- alpha | |
- next | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]') && startsWith(github.event.head_commit.message , 'chore(release):')" | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
# Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖 | |
# https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} # semantic-release 需要 >= 16 的 Node.js 环境 | |
cache: 'yarn' | |
# 发布开始通知 | |
- name: Release start ding talk dev group notify | |
uses: zcong1993/actions-ding@master | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
ignoreError: true | |
body: | | |
{ | |
"msgtype": "link", | |
"link": { | |
"title": "🚑 开始自动发布 (${{ github.head_ref || github.ref_name }}) 🚑", | |
"text": "🔗 请点击链接查看详情", | |
"messageUrl": "https://github.com/antvis/S2/actions/workflows/auto-release.yml", | |
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*gt5-RZDjt3IAAAAAAAAAAAAADmJ7AQ/original" | |
} | |
} | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build | |
# 自动发布完成后 触发 github.release.published 事件 | |
# 如果是 action 自带的 机器人 token, 出于安全考虑, github 会禁止循环触发, 使用真实用户的 token 可解决这个问题 | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.JINKE_GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: yarn release | |
# 发布失败通知内部开发群 | |
- name: Release failed ding talk dev group notify | |
if: ${{ failure() }} | |
uses: zcong1993/actions-ding@master | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
ignoreError: true | |
body: | | |
{ | |
"msgtype": "link", | |
"link": { | |
"title": "🚨 自动发布失败 (${{ github.head_ref || github.ref_name }})", | |
"text": "🔗 请点击链接查看具体原因, 及时修复, 尝试点击右上角 [Re-run all jobs] 重试, 或手动发布 🚑", | |
"messageUrl": "https://github.com/antvis/S2/actions/workflows/auto-release.yml", | |
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*PRSkSqsE_vYAAAAAAAAAAAAADmJ7AQ/original" | |
} | |
} |