debug(ci): enhance JWT secret and environment variable handling #25
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 the websocket server | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v2 | |
| - name: Debug - Show directory contents | |
| run: ls -la | |
| - name: Debug - Show package.json | |
| run: cat package.json | |
| - name: Docker login | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile.websocket | |
| push: true | |
| tags: coderomm/collabydraw-websocket:${{ github.sha }} | |
| - name: Deploy to the VM | |
| run: | | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" &> ~/ssh_key | |
| chmod 700 /home/runner/ssh_key | |
| ssh -o StrictHostKeyChecking=no -i ~/ssh_key [email protected] -t "docker stop user_backend && docker run --name user_backend -d -p 8080:8080 coderomm/collabydraw-websocket:${{ github.sha }}" |