mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
863f61d908
Co-authored-by: afc163 <afc163@gmail.com>
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
# When pushing a tag. this workflow will trigger site deployment and fixed version address comments
|
|
|
|
name: Deploy website
|
|
on:
|
|
push:
|
|
tags:
|
|
- '5.*'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
if: (startsWith(github.ref, 'refs/tags/') && (contains(github.ref_name, '-') == false)) || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- run: bun install
|
|
|
|
- name: build site
|
|
run: bun run predeploy
|
|
env:
|
|
NODE_OPTIONS: --max_old_space_size=4096
|
|
|
|
- name: build dist and bundle analyzer report
|
|
run: bun run dist
|
|
env:
|
|
ANALYZER: 1
|
|
NODE_OPTIONS: --max_old_space_size=4096
|
|
|
|
- name: Get version
|
|
id: publish-version
|
|
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Deploy to GitHub Pages
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./_site
|
|
force_orphan: true
|
|
|
|
# Since force_orphan will not trigger Sync to Gitee, we need to force run it here
|
|
- name: Sync to Gitee
|
|
uses: wearerequired/git-mirror-action@v1
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.GITEE_SSH_PRIVATE_KEY }}
|
|
with:
|
|
source-repo: 'git@github.com:ant-design/ant-design.git'
|
|
destination-repo: 'git@gitee.com:ant-design/ant-design.git'
|
|
|
|
- name: Deploy to Surge (with TAG)
|
|
run: |
|
|
export DEPLOY_DOMAIN=ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh
|
|
cp report.html ./_site
|
|
npx surge --project ./_site --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
|
|
|
|
- name: Create Commit Comment
|
|
uses: peter-evans/commit-comment@v3
|
|
with:
|
|
body: |
|
|
- Documentation site for this release: https://ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh
|
|
- Webpack bundle analyzer report page: https://ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh/report.html
|
|
|