Deploy Leaderboard Worker to VPS #15
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 Leaderboard Worker to VPS | |
| on: | |
| workflow_run: | |
| workflows: ["Leaderboard Worker GHCR Image"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| name: Deploy to VPS | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | |
| timeout-minutes: 10 | |
| env: | |
| VPS_HOST: ${{ secrets.VPS_HOST }} | |
| VPS_USER: ${{ secrets.VPS_USER }} | |
| VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }} | |
| VPS_SSH_PORT: ${{ secrets.VPS_SSH_PORT || '22' }} | |
| steps: | |
| - name: Deploy via SSH | |
| if: ${{ env.VPS_HOST != '' && env.VPS_USER != '' && env.VPS_SSH_KEY != '' }} | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ env.VPS_HOST }} | |
| username: ${{ env.VPS_USER }} | |
| key: ${{ env.VPS_SSH_KEY }} | |
| port: ${{ env.VPS_SSH_PORT }} | |
| script: | | |
| cd ~/projects/DevImpact || cd /app || exit 1 | |
| git fetch origin main | |
| git reset --hard origin/main | |
| bash ops/deploy/deploy-leaderboard.sh |