Files
games/.gitea/workflows/deploy.yml
Ryan Hamamura 649762e6c6
Some checks failed
CI / Deploy / test (push) Successful in 13s
CI / Deploy / lint (push) Successful in 25s
CI / Deploy / deploy (push) Has been cancelled
fix: stop old c4 container before starting renamed games container
The renamed container can't bind port 8080 while the old c4 container
still holds it.
2026-03-02 22:56:23 -10:00

66 lines
1.4 KiB
YAML

name: CI / Deploy
on:
push:
branches: [main]
pull_request:
env:
DEPLOY_DIR: /home/ryan/games
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Generate templ
run: go tool templ generate
- name: Run tests
run: go test ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Generate templ
run: go tool templ generate
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
- name: Run linter
run: golangci-lint run
deploy:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [test, lint]
runs-on: games
steps:
- uses: actions/checkout@v4
- name: Sync to deploy directory
run: |
mkdir -p $DEPLOY_DIR
rsync -a --delete --exclude 'data/' . $DEPLOY_DIR/
- name: Ensure data directory exists with correct ownership
run: |
mkdir -p $DEPLOY_DIR/data
- name: Stop old c4 container if running
run: docker rm -f c4 2>/dev/null || true
- name: Rebuild and restart
run: cd $DEPLOY_DIR && docker compose up -d --build --remove-orphans