Datastar-pro is fetched from a private Gitea repo (ryan/vendor-libs) using VENDOR_TOKEN for CI/Docker builds, with a local fallback from ../optional/ for development. DaisyUI is pinned to v5.5.19 instead of tracking latest. Downloaded files are now gitignored and fetched at build time via 'task download', which is a dependency of both build and live tasks.
74 lines
1.7 KiB
YAML
74 lines
1.7 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
|
|
with:
|
|
fetch-depth: 0 # Need full history for git describe
|
|
|
|
- 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: Rebuild and restart
|
|
env:
|
|
VENDOR_TOKEN: ${{ secrets.VENDOR_TOKEN }}
|
|
run: |
|
|
cd $DEPLOY_DIR
|
|
VERSION=$(git describe --tags --always)
|
|
COMMIT=$(git rev-parse --short HEAD)
|
|
VERSION=$VERSION COMMIT=$COMMIT VENDOR_TOKEN=$VENDOR_TOKEN docker compose up -d --build --remove-orphans
|
|
|
|
- name: Prune unused images
|
|
run: docker image prune -f
|