Skip to content

🔧 More tweaks to staging action #4

🔧 More tweaks to staging action

🔧 More tweaks to staging action #4

Workflow file for this run

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