14
14
build-site :
15
15
runs-on : ubuntu-latest
16
16
if : (startsWith(github.ref, 'refs/tags/') && (contains(github.ref_name, '-') == false)) || github.event_name == 'workflow_dispatch'
17
+
18
+ # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-defining-outputs-for-a-job
19
+ outputs :
20
+ formatted_version : ${{ steps.shared-formatted_version.outputs.VERSION }}
21
+
17
22
steps :
18
23
- name : checkout
19
24
uses : actions/checkout@v4
46
51
path : _site/
47
52
retention-days : 1 # Not need to keep for too long
48
53
54
+ - name : Format version
55
+ if : ${{ always() }}
56
+ id : shared-formatted_version
57
+ run : echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT
58
+
49
59
deploy-to-pages :
50
60
runs-on : ubuntu-latest
51
61
needs : build-site
58
68
name : real-site
59
69
path : _site
60
70
61
- - name : Get version
62
- id : publish-version
63
- run : echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT
64
-
65
71
- name : Deploy to GitHub Pages
66
72
uses : peaceiris/actions-gh-pages@v4
67
73
with :
@@ -81,15 +87,15 @@ jobs:
81
87
82
88
- name : Deploy to Surge (with TAG)
83
89
run : |
84
- export DEPLOY_DOMAIN=ant-design-${{ steps.publish-version .outputs.VERSION }}.surge.sh
90
+ export DEPLOY_DOMAIN=ant-design-${{ needs.build-site .outputs.formatted_version }}.surge.sh
85
91
bunx surge --project ./_site --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
86
92
87
93
- name : Create Commit Comment
88
94
uses : peter-evans/commit-comment@v3
89
95
with :
90
96
body : |
91
- - Documentation site for this release: https://ant-design-${{ steps.publish-version .outputs.VERSION }}.surge.sh
92
- - Webpack bundle analyzer report page: https://ant-design-${{ steps.publish-version .outputs.VERSION }}.surge.sh/report.html
97
+ - Documentation site for this release: https://ant-design-${{ needs.build-site .outputs.formatted_version }}.surge.sh
98
+ - Webpack bundle analyzer report page: https://ant-design-${{ needs.build-site .outputs.formatted_version }}.surge.sh/report.html
93
99
94
100
# https://github.com/ant-design/ant-design/pull/49213/files#r1625446496
95
101
upload-to-release :
@@ -107,8 +113,7 @@ jobs:
107
113
- name : Tarball site
108
114
run : |
109
115
cd ./_site
110
- VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')
111
- tar -czf ../website.tar.gz --transform 's|^|antd-${VERSION}-website/|' .
116
+ tar -czf ../website.tar.gz --transform 's|^|antd-${{ needs.build-site.outputs.formatted_version }}-website/|' .
112
117
cd ..
113
118
114
119
- name : Upload to Release
0 commit comments