Deploy using SSH and Docker Compose #90
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 using SSH and Docker Compose | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| name: Run ssh command on host machine | |
| runs-on: ubuntu-latest | |
| environment: deploy | |
| steps: | |
| - name: Tailscale | |
| uses: tailscale/github-action@v2 | |
| with: | |
| oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
| oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
| tags: tag:hhai-dev-ci | |
| - name: Run ssh deploy command | |
| run: | | |
| ssh -o StrictHostKeyChecking=no github-actions@hetzner-server " | |
| cd ~/hhai.dev | |
| git fetch origin main | |
| git reset --hard origin/main | |
| echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| docker compose -f docker/docker-compose.prod.yml -p hhai-dev pull | |
| docker compose -f docker/docker-compose.prod.yml -p hhai-dev --env-file=./.env up --detach --no-build --remove-orphans | |
| docker compose -f docker/docker-compose.prod.yml -p hhai-dev restart caddy | |
| docker compose -f docker/docker-compose.prod.yml -p hhai-dev restart vector | |
| docker system prune --all --volumes --force | |
| " |