TAG_PUSH #1680
This file contains hidden or 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
# 文件名建议统一为 tag-push.yml | |
# 应用 publish.yml 的 demo | |
name: TAG_PUSH | |
on: create | |
jobs: | |
TAG_PUSH: | |
runs-on: ubuntu-latest | |
if: github.event.ref_type == 'tag' | |
steps: | |
# 检出代码仓库,并递归初始化子模块 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# 设置 pnpm | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
# 设置 Node.js 环境,版本为 18 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
# 安装依赖 | |
- run: pnpm i | |
- run: echo "🍏 This job's status is ${{ job.status }}." | |
- run: pnpm run build | |
- name: publish | |
id: publish | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.TDESIGN_NPM_TOKEN }} | |
package: packages/tdesign-react | |
tag: ${{ contains(github.ref_name, 'beta') && 'beta' || 'latest' }} | |
- if: steps.publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
DEPLOY_HISTORY_VERSION_SITE: | |
runs-on: ubuntu-latest | |
if: github.event.ref_type == 'tag' | |
steps: | |
# 检出代码仓库,并递归初始化子模块 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# 设置 pnpm | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
# 设置 Node.js 环境,版本为 18 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
# 安装依赖 | |
- run: pnpm i | |
- name: Build site | |
run: pnpm run site:preview | |
- name: upload surge service | |
id: deploy | |
run: | | |
repository=${{github.repository}} | |
project_name=${repository#*/} | |
ref_name=${{ github.ref_name }} | |
tag_name=${ref_name//./_} | |
export DEPLOY_DOMAIN=https://$tag_name-$project_name.surge.sh | |
npx surge --project packages/tdesign-react/site/dist --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }} | |
echo $DEPLOY_DOMAIN | |
UPDATE_OFFICIAL_WEBSITE: | |
runs-on: ubuntu-latest | |
if: github.event.ref_type == 'tag' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
token: ${{ secrets.PERSONAL_TOKEN }} | |
submodules: recursive | |
- name: update official website | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git status | |
git fetch origin | |
git merge origin/develop | |
git push origin main | |