Skip to content

Deploy to Production (on VPS) #1942

Deploy to Production (on VPS)

Deploy to Production (on VPS) #1942

Workflow file for this run

name: Deploy to Production (on VPS)
on:
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# source: https://stackoverflow.com/a/65698892
# triggers this deployment after scaper runs
# for now this might have superfluous runs because the
# scraper will run and not commit anything, but after #215 is solved
# then it should only run after castablasta pushes a new episode
workflow_run:
# putting the comment here to enable prod changes in the future to leverage the created containers
workflows: ["Scrape and commit"] #, "Building Prod Container"]
types:
- completed
jobs:
deploy-via-tailscale:
runs-on: ubuntu-latest
steps:
# deploys using alexktz tailnet
- name: Connect Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Do the deploy thing
run: |
ssh -o "StrictHostKeyChecking no" ironicbadger@jb-core "
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GHCR_TOKEN }}
cd ${{ secrets.VPS_PROJECT_PATH }}
git pull
docker build -t ghcr.io/jupiterbroadcasting/jupiterbroadcasting.com:latest .
docker push ghcr.io/jupiterbroadcasting/jupiterbroadcasting.com:latest
docker container prune -f
docker image prune -f
docker compose -f ~/docker-compose.yml up -d jb-jbcom
"