sarsooxyz.hugo/.github/workflows/docker.yml
2024-07-02 20:34:03 +01:00

54 lines
1.3 KiB
YAML

name: Deploy Hugo site to Prod
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
name: Build Container
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Container
uses: docker/build-push-action@v2
with:
push: true
tags: sarsoo/sarsooxyz.hugo:latest
file: Dockerfile.pub
deploy:
runs-on: ubuntu-latest
name: Deploy Prod
needs: [docker] # for ignoring bad builds
environment:
name: prod
url: https://sarsoo.xyz
steps:
- uses: actions/checkout@v3
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
version: 1.68.1
- name: Deploy
run: ssh -o StrictHostKeyChecking=no aj@odb -t "cd sarsooxyz-hugo/ && docker compose up -d --pull always"