Deploy API to Render and VPS #95
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 API to VPS | |
on: | |
workflow_run: | |
workflows: | |
- Build API image | |
branches: | |
- main | |
types: | |
- completed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Remove old container | |
run: | | |
echo ${{ secrets.FROG_KEY }} | base64 -d > frog && | |
chmod 600 frog && | |
ssh -o StrictHostKeyChecking=no -i frog ${{ secrets.FROG_ADDRESS }} -p${{ secrets.FROG_PORT }} "docker rm -f flush-log-api" || true | |
- name: Remove old image | |
run: | | |
echo ${{ secrets.FROG_KEY }} | base64 -d > frog && | |
chmod 600 frog && | |
ssh -o StrictHostKeyChecking=no -i frog ${{ secrets.FROG_ADDRESS }} -p${{ secrets.FROG_PORT }} "docker image rm ghcr.io/pgulb/flush-log:api" || true | |
- name: Deploy fresh container | |
run: | | |
echo ${{ secrets.FROG_KEY }} | base64 -d > frog && | |
chmod 600 frog && | |
ssh -o StrictHostKeyChecking=no -i frog ${{ secrets.FROG_ADDRESS }} -p${{ secrets.FROG_PORT }} "docker run -d -p 30149:6789 -e MONGO_URL='${{ secrets.MONGO_URL }}' --name flush-log-api --restart=unless-stopped ghcr.io/pgulb/flush-log:api" |