Skip to content

Commit 48f85d6

Browse files
authored
ci: fix formatting (#51971)
1 parent 88bf8bc commit 48f85d6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

.github/workflows/site-deploy.yml

+14-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
build-site:
1515
runs-on: ubuntu-latest
1616
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+
1722
steps:
1823
- name: checkout
1924
uses: actions/checkout@v4
@@ -46,6 +51,11 @@ jobs:
4651
path: _site/
4752
retention-days: 1 # Not need to keep for too long
4853

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+
4959
deploy-to-pages:
5060
runs-on: ubuntu-latest
5161
needs: build-site
@@ -58,10 +68,6 @@ jobs:
5868
name: real-site
5969
path: _site
6070

61-
- name: Get version
62-
id: publish-version
63-
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT
64-
6571
- name: Deploy to GitHub Pages
6672
uses: peaceiris/actions-gh-pages@v4
6773
with:
@@ -81,15 +87,15 @@ jobs:
8187

8288
- name: Deploy to Surge (with TAG)
8389
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
8591
bunx surge --project ./_site --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
8692
8793
- name: Create Commit Comment
8894
uses: peter-evans/commit-comment@v3
8995
with:
9096
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
9399
94100
# https://github.com/ant-design/ant-design/pull/49213/files#r1625446496
95101
upload-to-release:
@@ -107,8 +113,7 @@ jobs:
107113
- name: Tarball site
108114
run: |
109115
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/|' .
112117
cd ..
113118
114119
- name: Upload to Release

0 commit comments

Comments
 (0)