This repository was archived by the owner on Apr 6, 2026. It is now read-only.
fix: handle missing access error in status routine #228
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 Production | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install SSH key | |
| uses: webfactory/ssh-agent@v0.5.3 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Pull repository and deploy | |
| env: | |
| NODE_ENV: production | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }} << 'EOF' | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| export PATH=$(nvm which current | xargs dirname):$PATH | |
| cd ${{ vars.DEPLOY_PATH }} | |
| # Pull the latest changes from the repository | |
| git fetch --all | |
| git reset --hard origin/main | |
| git pull | |
| # Install dependencies and build the project | |
| npm install | |
| npm run build | |
| # Migrate the database and generate Prisma client | |
| npx prisma migrate deploy | |
| npx prisma generate | |
| # Restart the PM2 process or start it if it doesn't exist | |
| if pm2 describe gmod-integration-api > /dev/null; then | |
| echo "Process exists. Restarting..." | |
| npm run reload | |
| else | |
| echo "Process does not exist. Starting..." | |
| npm run start | |
| fi | |
| EOF |