refactor(demos): migrate FileCard components to ax-file-card and upda… #129
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: | |
| deploy: | |
| 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: 22 | |
| 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: 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." |