Files
Erupe/.github/workflows/release.yml
Houmgaor 27fb0faa1e feat(db): add embedded auto-migrating schema system
Replace 4 independent schema management code paths (Docker shell
script, setup wizard pg_restore, test helpers, manual psql) with a
single migration runner embedded in the server binary.

The new server/migrations/ package uses Go embed to bundle all SQL
schemas. On startup, Migrate() creates a schema_version tracking
table, detects existing databases (auto-marks baseline as applied),
and runs pending migrations in transactions.

Key changes:
- Consolidated init.sql + 9.2-update + 33 patches into 0001_init.sql
- Setup wizard simplified to single "Apply schema" checkbox
- Test helpers use migrations.Migrate() instead of pg_restore
- Docker no longer needs schema volume mounts or init script
- Seed data (shops, events, gacha) embedded and applied via API
- Future migrations just add 0002_*.sql files — no manual steps
2026-02-23 21:19:21 +01:00

82 lines
1.9 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.os_name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
os_name: Linux-amd64
binary: erupe-ce
- goos: windows
goarch: amd64
os_name: Windows-amd64
binary: erupe-ce.exe
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Download dependencies
run: go mod download
- name: Build
run: env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -v -o ${{ matrix.binary }}
- name: Prepare release archive
run: |
mkdir -p staging
cp ${{ matrix.binary }} staging/
cp config.example.json staging/
cp -r www/ staging/www/
cp -r savedata/ staging/savedata/
# Schema is now embedded in the binary via server/migrations/
cd staging && zip -r ../erupe-${{ matrix.os_name }}.zip .
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os_name }}
path: erupe-${{ matrix.os_name }}.zip
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Copy standalone schema for download
run: cp server/migrations/sql/0001_init.sql SCHEMA.sql
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/Linux-amd64/erupe-Linux-amd64.zip
artifacts/Windows-amd64/erupe-Windows-amd64.zip
SCHEMA.sql