forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (99 loc) · 3.72 KB
/
site-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# 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-site:
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: move report.html to _site
run: |
if [ -f report.html ]; then
mv report.html _site && echo "report.html moved to _site"
fi
- 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:
- uses: oven-sh/setup-bun@v2
- name: download site artifact
uses: actions/download-artifact@v4
with:
name: real-site
path: _site
- 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
exclude_files: ./_site/report.html # 👈 这个功能是 beta, 但即便不排除,也不 care
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: '[email protected]:ant-design/ant-design.git'
destination-repo: '[email protected]:ant-design/ant-design.git'
- name: Deploy to Surge (with TAG)
run: |
export DEPLOY_DOMAIN=ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh
bunx 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
# https://github.com/ant-design/ant-design/pull/49213/files#r1625446496
upload-to-release:
runs-on: ubuntu-latest
# 仅在 tag 的时候工作,因为我们要将内容发布到以 tag 为版本号的 release 里
if: startsWith(github.ref, 'refs/tags/')
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
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
with:
fail_on_unmatched_files: true
files: website.tar.gz