Backup .env/port.txt in deploy workflow, graceful fallback in server.js #10
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 Beta | |
| on: | |
| push: | |
| branches: [beta] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: SSH and deploy | |
| uses: appleboy/ssh-action@v1.2.0 | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USER }} | |
| password: ${{ secrets.SSH_PASSWORD }} | |
| port: ${{ secrets.SSH_PORT || 22 }} | |
| script: | | |
| cd ${{ secrets.BETA_PATH }} | |
| cp .env /tmp/beta.env 2>/dev/null; cp port.txt /tmp/beta.port.txt 2>/dev/null | |
| git fetch origin | |
| git checkout -f -B beta origin/beta | |
| cp /tmp/beta.env .env 2>/dev/null; cp /tmp/beta.port.txt port.txt 2>/dev/null | |
| npm install | |
| pm2 restart beta |