| |
|
|
| 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' |
|
|
| |
| outputs: |
| formatted_version: ${{ steps.shared-formatted_version.outputs.VERSION }} |
|
|
| 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 |
|
|
| - name: Format version |
| if: ${{ always() }} |
| id: shared-formatted_version |
| run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT |
|
|
| 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: Deploy to GitHub Pages |
| uses: peaceiris/actions-gh-pages@v4 |
| with: |
| github_token: ${{ secrets.GITHUB_TOKEN }} |
| publish_dir: ./_site |
| exclude_files: ./_site/report.html |
| force_orphan: true |
|
|
| |
| - 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-${{ needs.build-site.outputs.formatted_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-${{ needs.build-site.outputs.formatted_version }}.surge.sh |
| - Webpack bundle analyzer report page: https://ant-design-${{ needs.build-site.outputs.formatted_version }}.surge.sh/report.html |
| |
| |
| upload-to-release: |
| runs-on: ubuntu-latest |
| |
| 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 |
| tar -czf ../website.tar.gz --transform 's|^|antd-${{ needs.build-site.outputs.formatted_version }}-website/|' . |
| cd .. |
| |
| - name: Upload to Release |
| uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 |
| with: |
| fail_on_unmatched_files: true |
| files: website.tar.gz |
|
|