Build Image 🏗️ and Deploy to VPS 🚀 #12
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 🚀 to VPS | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| cache: "npm" | |
| - run: npm install | |
| - run: npm run build --if-present | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-build | |
| path: .output/ | |
| include-hidden-files: true | |
| deploy: | |
| runs-on: ubuntu-latest | |
| name: Deploy to VPS | |
| needs: build | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: app-build | |
| path: ./ | |
| - name: Display build directory | |
| run: ls -R | |
| - name: Deploy to VPS | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USERNAME }} | |
| key: ${{ secrets.SSH_KEY }} | |
| port: ${{ secrets.SSH_PORT }} | |
| passphrase: ${{ secrets.SSH_PASSPHRASE }} | |
| source: "./.output" | |
| target: "~/sourcedepth.com/" | |
| overwrite: true |