name: Release # A pushed tag like v1.2.3 builds every client and attaches the result to a # Gitea release of the same name. Tag a commit that has already passed CI # on main; this workflow doesn't re-run those checks. on: push: tags: ["v*.*.*"] jobs: # cmd/api and cmd/tui are pure Go (no cgo), so they cross-compile cleanly # from one Linux runner for every OS/arch below. build-go: 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 - name: Build api and 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/completed-api${ext}" ./cmd/api go build -o "dist/completed-tui${ext}" ./cmd/tui - name: Archive run: | cd dist base="completed_${{ matrix.goos }}_${{ matrix.goarch }}" if [ "${{ matrix.goos }}" = "windows" ]; then zip "../${base}.zip" completed-api.exe completed-tui.exe else tar czf "../${base}.tar.gz" completed-api completed-tui fi - uses: actions/upload-artifact@v4 with: name: completed_${{ matrix.goos }}_${{ matrix.goarch }} path: completed_${{ matrix.goos }}_${{ matrix.goarch }}.* retention-days: 7 # cmd/gui (Fyne) uses cgo and links the system's native GL/windowing # libraries, so - unlike build-go above - it can't be cross-compiled for # other operating systems from this one Linux runner. This job only # produces a linux/amd64 build. A macOS or Windows build of the GUI would # need this workflow extended with a job running on a matching # self-hosted runner (there isn't one registered for this repo today). build-gui-linux: runs-on: ubuntu-latest 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 libgl1-mesa-dev xorg-dev - name: Build gui run: | mkdir -p dist go build -o dist/completed-gui ./cmd/gui - name: Archive run: tar czf completed-gui_linux_amd64.tar.gz -C dist completed-gui - uses: actions/upload-artifact@v4 with: name: completed-gui_linux_amd64 path: completed-gui_linux_amd64.tar.gz 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 completed-web_dist.tar.gz -C web/dist/web . - uses: actions/upload-artifact@v4 with: name: completed-web_dist path: completed-web_dist.tar.gz retention-days: 7 release: needs: [build-go, build-gui-linux, build-web] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: path: artifacts merge-multiple: true - name: Create the Gitea release and upload each artifact env: # Gitea Actions auto-provides this for the compatibility GITHUB_* # context; it needs the repo's Settings > Actions permissions set # to allow writing contents. If your instance doesn't populate it, # replace with a secret holding a personal/repo access token that # has repo write access instead. GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} SERVER_URL: ${{ github.server_url }} REPO: ${{ github.repository }} TAG: ${{ github.ref_name }} run: | set -euo pipefail sudo apt-get update && sudo apt-get install -y jq release_json=$(curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"draft\":false,\"prerelease\":false}" \ "${SERVER_URL}/api/v1/repos/${REPO}/releases") release_id=$(echo "$release_json" | jq -r '.id') if [ -z "$release_id" ] || [ "$release_id" = "null" ]; then echo "Failed to create release: $release_json" >&2 exit 1 fi for f in artifacts/*; do name=$(basename "$f") echo "Uploading $name" curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -F "attachment=@${f}" \ "${SERVER_URL}/api/v1/repos/${REPO}/releases/${release_id}/assets?name=${name}" done