CI / go (push) Successful in 43s
CI / sqlc (push) Successful in 7s
CI / web (push) Successful in 18s
Release / build-tui (amd64, linux) (push) Successful in 25s
Release / build-tui (amd64, darwin) (push) Successful in 26s
CI / docker (push) Successful in 1m0s
Release / build-tui (arm64, darwin) (push) Successful in 21s
Release / build-tui (amd64, windows) (push) Successful in 21s
Release / build-tui (arm64, linux) (push) Successful in 43s
Release / build-web (push) Successful in 38s
Release / build-gui (amd64, windows, gcc-mingw-w64-x86-64) (push) Successful in 57s
Release / build-gui (amd64, linux, libgl1-mesa-dev xorg-dev libwayland-dev libxkbcommon-dev) (push) Successful in 1m4s
Release / build-docker (push) Successful in 47s
Release / release (push) Successful in 24s
The Docker image (build-docker) is the real distribution path for the server; a raw completed-api binary alongside it was a redundant artifact nobody was going to run directly. Renamed build-go -> build-tui since it now only builds the tui, which is a real CLI people do run on their own machine. Updated the release job's `needs:` and stale comments that still said build-go. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
213 lines
6.9 KiB
YAML
213 lines
6.9 KiB
YAML
#
|
|
# .gitea/workflows/release.yml
|
|
#
|
|
# On a version tag (e.g. v1.2.3): builds every client, pushes the API's
|
|
# Docker image, uploads all build artifacts to the Gitea generic package
|
|
# registry, and creates a Gitea release with those same files attached.
|
|
#
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*.*.*"]
|
|
|
|
env:
|
|
PROJECT_NAME: Completed
|
|
REGISTRY: gitea.sanplex.xyz
|
|
REGISTRY_OWNER: sansan
|
|
|
|
jobs:
|
|
# cmd/api isn't built here: the Docker image (build-docker below) is the
|
|
# distribution path for the server, so a standalone api binary would
|
|
# just be a redundant artifact nobody runs directly. cmd/tui is a real
|
|
# CLI people run on their own machine, and it's pure Go (no cgo), so it
|
|
# cross-compiles cleanly from one Linux runner for every OS/arch below.
|
|
build-tui:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- goos: linux
|
|
goarch: amd64
|
|
- goos: linux
|
|
goarch: arm64
|
|
- goos: darwin
|
|
goarch: amd64
|
|
- goos: darwin
|
|
goarch: arm64
|
|
- goos: windows
|
|
goarch: amd64
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
# Built with its final release filename directly (rather than a
|
|
# generic name plus a separate archive step), so what comes out of
|
|
# dist/ is exactly what gets uploaded: a raw executable, no
|
|
# zip/tar.gz. One real trade-off: a raw upload doesn't preserve the
|
|
# Unix executable bit the way a tar.gz would, so linux/darwin
|
|
# downloads need a manual `chmod +x` before running; .exe is
|
|
# unaffected.
|
|
- name: Build tui
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
CGO_ENABLED: "0"
|
|
run: |
|
|
mkdir -p dist
|
|
ext=""
|
|
if [ "${{ matrix.goos }}" = "windows" ]; then ext=".exe"; fi
|
|
go build -o "dist/${PROJECT_NAME}-tui_${{ matrix.goos }}_${{ matrix.goarch }}${ext}" ./cmd/tui
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.PROJECT_NAME }}-tui_${{ matrix.goos }}_${{ matrix.goarch }}
|
|
path: dist/*
|
|
retention-days: 7
|
|
|
|
# cmd/gui (Fyne) uses cgo, so unlike build-tui above it can't just cross-
|
|
# compile with CGO_ENABLED=0. Linux is native to this runner; Windows
|
|
# cross-compiles cleanly with the mingw-w64 toolchain (verified locally:
|
|
# a real PE32+ GUI-subsystem .exe, linking Fyne's OpenGL/glfw backend,
|
|
# with no changes needed beyond CC and the usual GOOS/GOARCH). macOS
|
|
# isn't included - cross-compiling cgo to Darwin from Linux has no
|
|
# equivalent well-supported toolchain, so that would need an actual
|
|
# macOS runner, which isn't registered for this repo.
|
|
build-gui:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- goos: linux
|
|
goarch: amd64
|
|
packages: libgl1-mesa-dev xorg-dev libwayland-dev libxkbcommon-dev
|
|
- goos: windows
|
|
goarch: amd64
|
|
packages: gcc-mingw-w64-x86-64
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ${{ matrix.packages }}
|
|
|
|
# Same reasoning as build-tui above: upload the raw executable, built
|
|
# with its final release name directly, no archive step.
|
|
- name: Build gui
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
CGO_ENABLED: "1"
|
|
run: |
|
|
mkdir -p dist
|
|
name="dist/${PROJECT_NAME}-gui_${{ matrix.goos }}_${{ matrix.goarch }}"
|
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
CC=x86_64-w64-mingw32-gcc go build -ldflags "-H=windowsgui" -o "${name}.exe" ./cmd/gui
|
|
else
|
|
go build -o "${name}" ./cmd/gui
|
|
fi
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.PROJECT_NAME }}-gui_${{ matrix.goos }}_${{ matrix.goarch }}
|
|
path: dist/*
|
|
retention-days: 7
|
|
|
|
build-web:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- name: Build
|
|
working-directory: web
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Archive
|
|
run: tar czf ${PROJECT_NAME}-web_dist.tar.gz -C web/dist/web/browser .
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.PROJECT_NAME }}-web_dist
|
|
path: ${{ env.PROJECT_NAME }}-web_dist.tar.gz
|
|
retention-days: 7
|
|
|
|
# Builds and pushes the API's image, which embeds the web build as its
|
|
# static UI (see the Dockerfile and cmd/api/main.go's registerWebUI).
|
|
build-docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
config-inline: |
|
|
[registry."${{ env.REGISTRY }}/${{ env.REGISTRY_OWNER }}"]
|
|
http = true
|
|
insecure = true
|
|
|
|
- name: Login to Gitea
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.REGISTRY_OWNER }}/completed:${{ gitea.ref_name }}
|
|
${{ env.REGISTRY }}/${{ env.REGISTRY_OWNER }}/completed:latest
|
|
|
|
release:
|
|
needs: [build-tui, build-gui, build-web]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
path: artifacts
|
|
# v3 has no merge-multiple: downloading all artifacts (no `name`
|
|
# given) lands each one in its own artifacts/<artifact-name>/
|
|
# subdirectory, not flattened - hence `find`, not a fixed-depth
|
|
# glob, in the step below.
|
|
|
|
- name: Upload to the Gitea generic package registry
|
|
env:
|
|
VERSION: ${{ gitea.ref_name }}
|
|
run: |
|
|
find artifacts -type f | while read -r f; do
|
|
name="$(basename "$f")"
|
|
echo "Uploading $name"
|
|
curl --fail --user "${{ github.repository_owner }}:${{ secrets.TOKEN }}" \
|
|
--upload-file "$f" \
|
|
"https://${{ env.REGISTRY }}/api/packages/${{ env.REGISTRY_OWNER }}/generic/${{ env.PROJECT_NAME }}/${VERSION}/${name}"
|
|
done
|
|
|
|
- name: Create release
|
|
uses: akkuman/gitea-release-action@v1
|
|
env:
|
|
NODE_OPTIONS: "--experimental-fetch" # if nodejs < 18
|
|
with:
|
|
files: |-
|
|
artifacts/**
|