Deploy Docs #57
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 Docs | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install root dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build heroshot | |
| run: pnpm build | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: v1-playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpm exec playwright install chromium | |
| - name: Update screenshots with heroshot | |
| run: node ../dist/cli.js | |
| working-directory: docs | |
| env: | |
| HEROSHOT_SESSION_KEY: ${{ secrets.HEROSHOT_SESSION_KEY }} | |
| - name: Install docs dependencies | |
| run: pnpm install | |
| working-directory: docs | |
| - name: Build docs | |
| run: pnpm build | |
| working-directory: docs | |
| - name: Deploy to server | |
| env: | |
| SSH_KEY: ${{ secrets.DOCS_DEPLOY_SSH_KEY }} | |
| SSH_HOST: ${{ secrets.DOCS_DEPLOY_SSH_HOST }} | |
| SSH_PORT: ${{ secrets.DOCS_DEPLOY_SSH_PORT }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "$SSH_KEY" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| echo "[${SSH_HOST}]:${SSH_PORT} ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICx97oyTuvLzKtygKR1u6P863fDiPOYNDBxdh7pZj602" >> ~/.ssh/known_hosts | |
| rsync -avz --delete \ | |
| -e "ssh -p ${SSH_PORT} -i ~/.ssh/deploy_key" \ | |
| docs/.vitepress/dist/ \ | |
| root@${SSH_HOST}:~/dockers/swag/swag/config/www/heroshot/ |