Deploy Docs #48
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 | |
| defaults: | |
| run: | |
| working-directory: docs | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| cache-dependency-path: docs/pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build docs | |
| run: pnpm build | |
| - 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" \ | |
| .vitepress/dist/ \ | |
| root@${SSH_HOST}:~/dockers/swag/swag/config/www/heroshot/ |