2022-12-09 17:19:40 +08:00
|
|
|
# When pushing a tag. this workflow will trigger site deployment and fixed version address comments
|
2021-02-19 20:35:43 +08:00
|
|
|
|
|
|
|
name: Deploy website
|
|
|
|
on:
|
2022-12-09 17:19:40 +08:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '5.*'
|
|
|
|
workflow_dispatch:
|
2021-02-19 20:35:43 +08:00
|
|
|
|
2022-04-11 11:15:26 +08:00
|
|
|
permissions:
|
2022-11-20 01:13:54 +08:00
|
|
|
contents: write
|
2022-04-11 11:15:26 +08:00
|
|
|
|
2021-02-19 20:35:43 +08:00
|
|
|
jobs:
|
2024-11-29 11:28:48 +08:00
|
|
|
build-site:
|
2021-02-19 20:35:43 +08:00
|
|
|
runs-on: ubuntu-latest
|
2024-08-18 00:23:19 +08:00
|
|
|
if: (startsWith(github.ref, 'refs/tags/') && (contains(github.ref_name, '-') == false)) || github.event_name == 'workflow_dispatch'
|
2021-02-19 20:35:43 +08:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
2023-09-05 11:55:52 +08:00
|
|
|
uses: actions/checkout@v4
|
2021-02-19 20:35:43 +08:00
|
|
|
|
2024-08-18 00:23:19 +08:00
|
|
|
- uses: oven-sh/setup-bun@v2
|
2021-02-19 20:35:43 +08:00
|
|
|
|
2024-08-18 00:23:19 +08:00
|
|
|
- run: bun install
|
2021-02-19 20:35:43 +08:00
|
|
|
|
2023-05-10 15:14:45 +08:00
|
|
|
- name: build site
|
2024-08-18 00:23:19 +08:00
|
|
|
run: bun run predeploy
|
2023-06-13 12:55:09 +08:00
|
|
|
env:
|
2024-09-19 03:30:19 +08:00
|
|
|
NODE_OPTIONS: --max_old_space_size=4096
|
2021-02-19 20:35:43 +08:00
|
|
|
|
2023-05-10 15:14:45 +08:00
|
|
|
- name: build dist and bundle analyzer report
|
2024-08-18 00:23:19 +08:00
|
|
|
run: bun run dist
|
2023-05-15 20:48:55 +08:00
|
|
|
env:
|
2023-05-31 10:16:19 +08:00
|
|
|
ANALYZER: 1
|
2024-09-19 03:30:19 +08:00
|
|
|
NODE_OPTIONS: --max_old_space_size=4096
|
2023-05-10 15:14:45 +08:00
|
|
|
|
2024-12-03 14:09:17 +08:00
|
|
|
- name: move report.html to _site
|
|
|
|
run: |
|
|
|
|
if [ -f report.html ]; then
|
|
|
|
mv report.html _site && echo "report.html moved to _site"
|
|
|
|
fi
|
|
|
|
|
2024-11-29 11:28:48 +08:00
|
|
|
- name: upload site artifact
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: real-site
|
|
|
|
path: _site/
|
|
|
|
retention-days: 1 # Not need to keep for too long
|
|
|
|
|
|
|
|
deploy-to-pages:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build-site
|
|
|
|
steps:
|
2024-12-03 18:32:32 +08:00
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
|
2024-11-29 11:28:48 +08:00
|
|
|
- name: download site artifact
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
name: real-site
|
|
|
|
path: _site
|
|
|
|
|
2022-12-07 17:44:00 +08:00
|
|
|
- name: Get version
|
|
|
|
id: publish-version
|
|
|
|
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Deploy to GitHub Pages
|
2024-04-09 20:39:17 +08:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2021-02-19 20:35:43 +08:00
|
|
|
with:
|
2022-11-20 01:13:54 +08:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-11-27 22:51:11 +08:00
|
|
|
publish_dir: ./_site
|
2024-12-03 14:09:17 +08:00
|
|
|
exclude_files: ./_site/report.html # 👈 这个功能是 beta, 但即便不排除,也不 care
|
2022-11-19 19:40:53 +08:00
|
|
|
force_orphan: true
|
2022-12-07 17:44:00 +08:00
|
|
|
|
2023-06-20 09:41:03 +08:00
|
|
|
# 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'
|
|
|
|
|
2022-12-07 17:44:00 +08:00
|
|
|
- name: Deploy to Surge (with TAG)
|
|
|
|
run: |
|
|
|
|
export DEPLOY_DOMAIN=ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh
|
2024-10-24 18:30:58 +08:00
|
|
|
bunx surge --project ./_site --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
|
2022-12-07 17:44:00 +08:00
|
|
|
|
|
|
|
- name: Create Commit Comment
|
2023-09-25 13:45:02 +08:00
|
|
|
uses: peter-evans/commit-comment@v3
|
2022-12-07 17:44:00 +08:00
|
|
|
with:
|
|
|
|
body: |
|
2023-05-10 15:14:45 +08:00
|
|
|
- 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
|
|
|
|
|
2024-11-29 11:28:48 +08:00
|
|
|
# https://github.com/ant-design/ant-design/pull/49213/files#r1625446496
|
|
|
|
upload-to-release:
|
|
|
|
runs-on: ubuntu-latest
|
2024-12-03 14:39:45 +08:00
|
|
|
# 仅在 tag 的时候工作,因为我们要将内容发布到以 tag 为版本号的 release 里
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2024-11-29 11:28:48 +08:00
|
|
|
needs: build-site
|
|
|
|
steps:
|
|
|
|
- name: download site artifact
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
name: real-site
|
|
|
|
path: _site
|
|
|
|
|
|
|
|
- name: Tarball site
|
|
|
|
run: |
|
|
|
|
cd ./_site
|
|
|
|
VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')
|
|
|
|
tar -czf ../website.tar.gz --transform 's|^|antd-${VERSION}-website/|' .
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Upload to Release
|
2024-12-01 16:03:15 +08:00
|
|
|
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
|
2024-11-29 11:28:48 +08:00
|
|
|
with:
|
|
|
|
fail_on_unmatched_files: true
|
|
|
|
files: website.tar.gz
|