Repository navigation
style(docs): center demo source loading (#170) #270
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy X | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: deploy-x-main | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| if: github.repository == 'antdv-next/x' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build site | |
| run: | | |
| pnpm docs:build | |
| rm -rf dist | |
| cp -r packages/docs/dist dist | |
| - name: Upload site artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-dist | |
| path: dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download site artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site-dist | |
| path: dist | |
| - name: Inspect downloaded site artifact | |
| run: ls -R dist | |
| - name: Scp dir to server | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USERNAME }} | |
| password: ${{ secrets.DEPLOY_PASSWORD }} | |
| port: ${{ secrets.DEPLOY_PORT }} | |
| source: dist | |
| target: ${{ secrets.DEPLOY_TARGET_PATH }} | |
| - name: Switch current site | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USERNAME }} | |
| password: ${{ secrets.DEPLOY_PASSWORD }} | |
| port: ${{ secrets.DEPLOY_PORT }} | |
| script: | | |
| set -eu | |
| TARGET="${{ secrets.DEPLOY_TARGET_PATH }}" | |
| mkdir -p "$TARGET/index" "$TARGET/index.bak" | |
| if [ -d "$TARGET/index" ] && [ -n "$(find "$TARGET/index" -mindepth 1 -maxdepth 1 2>/dev/null)" ]; then | |
| find "$TARGET/index.bak" -mindepth 1 -maxdepth 1 -exec rm -rf {} + | |
| find "$TARGET/index" -mindepth 1 -maxdepth 1 -exec mv {} "$TARGET/index.bak"/ \; | |
| fi | |
| if [ ! -d "$TARGET/dist" ] || [ -z "$(find "$TARGET/dist" -mindepth 1 -maxdepth 1 2>/dev/null)" ]; then | |
| echo "No dist files uploaded; abort." | |
| exit 1 | |
| fi | |
| find "$TARGET/index" -mindepth 1 -maxdepth 1 -exec rm -rf {} + | |
| find "$TARGET/dist" -mindepth 1 -maxdepth 1 -exec mv {} "$TARGET/index"/ \; | |
| - name: Deployment completed | |
| run: echo "Deployment to server completed successfully." | |
| deploy-cn: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download site artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site-dist | |
| path: dist | |
| - name: Inspect downloaded site artifact | |
| run: ls -R dist | |
| - name: Scp dir to CN server | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST_CN }} | |
| username: ${{ secrets.DEPLOY_USERNAME_CN }} | |
| password: ${{ secrets.DEPLOY_PASSWORD_CN }} | |
| port: ${{ secrets.DEPLOY_PORT_CN }} | |
| source: dist | |
| target: ${{ secrets.DEPLOY_TARGET_PATH_CN }} | |
| - name: Switch current site on CN server | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST_CN }} | |
| username: ${{ secrets.DEPLOY_USERNAME_CN }} | |
| password: ${{ secrets.DEPLOY_PASSWORD_CN }} | |
| port: ${{ secrets.DEPLOY_PORT_CN }} | |
| script: | | |
| set -eu | |
| TARGET="${{ secrets.DEPLOY_TARGET_PATH_CN }}" | |
| mkdir -p "$TARGET/index" "$TARGET/index.bak" | |
| if [ -d "$TARGET/index" ] && [ -n "$(find "$TARGET/index" -mindepth 1 -maxdepth 1 2>/dev/null)" ]; then | |
| find "$TARGET/index.bak" -mindepth 1 -maxdepth 1 -exec rm -rf {} + | |
| find "$TARGET/index" -mindepth 1 -maxdepth 1 -exec mv {} "$TARGET/index.bak"/ \; | |
| fi | |
| if [ ! -d "$TARGET/dist" ] || [ -z "$(find "$TARGET/dist" -mindepth 1 -maxdepth 1 2>/dev/null)" ]; then | |
| echo "No dist files uploaded; abort." | |
| exit 1 | |
| fi | |
| find "$TARGET/index" -mindepth 1 -maxdepth 1 -exec rm -rf {} + | |
| find "$TARGET/dist" -mindepth 1 -maxdepth 1 -exec mv {} "$TARGET/index"/ \; | |
| - name: Deployment completed on CN server | |
| run: echo "Deployment to CN server completed successfully." |