|
| 1 | +# When pushing a tag. this workflow will trigger site deployment and fixed version address comments |
| 2 | + |
| 3 | +name: Deploy website |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - '1.*' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-and-deploy: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: (startsWith(github.ref, 'refs/tags/') && (contains(github.ref_name, '-') == false)) || github.event_name == 'workflow_dispatch' |
| 17 | + steps: |
| 18 | + - name: checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - uses: oven-sh/setup-bun@v2 |
| 22 | + |
| 23 | + - run: bun install |
| 24 | + |
| 25 | + - name: build site |
| 26 | + run: bun run predeploy |
| 27 | + env: |
| 28 | + NODE_OPTIONS: --max_old_space_size=4096 |
| 29 | + |
| 30 | + - name: build dist and bundle analyzer report |
| 31 | + run: bun run dist |
| 32 | + env: |
| 33 | + ANALYZER: 1 |
| 34 | + NODE_OPTIONS: --max_old_space_size=4096 |
| 35 | + |
| 36 | + - name: Get version |
| 37 | + id: publish-version |
| 38 | + run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT |
| 39 | + |
| 40 | + - name: Deploy to GitHub Pages |
| 41 | + uses: peaceiris/actions-gh-pages@v4 |
| 42 | + with: |
| 43 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + publish_dir: ./_site |
| 45 | + force_orphan: true |
| 46 | + |
| 47 | + # Since force_orphan will not trigger Sync to Gitee, we need to force run it here |
| 48 | + - name: Sync to Gitee |
| 49 | + uses: wearerequired/git-mirror-action@v1 |
| 50 | + env: |
| 51 | + SSH_PRIVATE_KEY: ${{ secrets.GITEE_SSH_PRIVATE_KEY }} |
| 52 | + with: |
| 53 | + source-repo: '[email protected]:ant-design/x.git' |
| 54 | + destination-repo: '[email protected]:ant-design/antd-x.git' |
| 55 | + |
| 56 | + - name: Deploy to Surge (with TAG) |
| 57 | + run: | |
| 58 | + export DEPLOY_DOMAIN=ant-design-x-${{ steps.publish-version.outputs.VERSION }}.surge.sh |
| 59 | + cp report.html ./_site |
| 60 | + bunx surge --project ./_site --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }} |
| 61 | +
|
| 62 | + - name: Create Commit Comment |
| 63 | + uses: peter-evans/commit-comment@v3 |
| 64 | + with: |
| 65 | + body: | |
| 66 | + - Documentation site for this release: https://ant-design-x-${{ steps.publish-version.outputs.VERSION }}.surge.sh |
| 67 | + - Webpack bundle analyzer report page: https://ant-design-x-${{ steps.publish-version.outputs.VERSION }}.surge.sh/report.html |
0 commit comments