🔧 More tweaks to staging action #4
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 to Staging | |
| on: | |
| push: | |
| branches: | |
| - staging | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -H ${{ secrets.LINODE_IP }} >> ~/.ssh/known_hosts | |
| - name: Deploy to Linode | |
| run: | | |
| ssh -T dev@${{ secrets.LINODE_IP }} << 'EOF' | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
| PNPM_PATH="$NVM_DIR/versions/node/$(nvm current)/bin/pnpm" | |
| cd /var/www/portfolio-next && \ | |
| source ~/.profile && \ | |
| git fetch origin && \ | |
| git checkout staging && \ | |
| git pull origin staging && \ | |
| $PNPM_PATH install && \ | |
| $PNPM_PATH build && \ | |
| pm2 restart next-staging | |
| EOF |