chore: run actions when .github/workflows changes, and set up pnpm #5
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: Build and Deploy Page to VPS | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/**" | |
| - ".gitignore" | |
| - "src/**" | |
| - "package*.json" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 'latest' | |
| cache: 'pnpm' | |
| - name: Install Node.js Dependencies | |
| run: pnpm install | |
| - name: Build Astro website | |
| run: pnpm run build | |
| # Deploy to VPS over SSH | |
| - name: Deploy Book to VPS | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.VPS_IP }} | |
| username: actions | |
| key: ${{ secrets.VPS_PRIV_KEY }} | |
| port: 22 | |
| source: "dist" | |
| target: "/home/actions/kitlang.dev" | |
| strip_components: 1 | |
| rm: true |