CI / go (Server) (push) Failing after 22s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 26s
CI / desktop (ubuntu-latest) (push) Failing after 23s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / mobile (push) Failing after 19s
CI / docker (push) Failing after 26s
Docs / build (push) Failing after 29s
Docs / deploy (push) Skipped
Release / images (., Docker-AIO/Dockerfile, docwell) (push) Failing after 20s
Release / images (., Server/Dockerfile, docwell-server) (push) Failing after 31s
Release / images (., Web-App/Dockerfile, docwell-web) (push) Failing after 28s
Release / images (Database, Database/Dockerfile, docwell-db) (push) Failing after 18s
Release / desktop (Desktop-App/bin/*.deb
Desktop-App/bin/*.rpm
Desktop-App/bin/*.AppImage
, linux, ubuntu-latest, linux:create:deb linux:create:rpm linux:create:appimage) (push) Failing after 14s
Release / desktop (Desktop-App/bin/*-installer.exe, windows, windows-latest, windows:package) (push) Canceled after 0s
Release / release (push) Canceled after 0s
- Images go to the registry of the Gitea that runs the workflow (or the REGISTRY variable), signed in with the REGISTRY_TOKEN secret. A plain http Gitea gets a plain http registry in BuildKit's config, and the credentials are written straight into the client config, since docker login refuses such registries. - The build cache is kept in the registry, not the GitHub Actions cache. - One release job creates the Gitea release through its API once every build has passed, and attaches the Windows and Linux installers. - macOS is left out: Gitea has no hosted Mac runners, so the DMG is built by hand. The docs link comes from the DOCS_URL variable instead of a github.io address. - AppImages are built without FUSE, which runner containers lack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
243 lines
9.0 KiB
YAML
243 lines
9.0 KiB
YAML
# Publishes a release on Gitea: push a tag like v1.0.0.
|
|
# Images go to the registry of the Gitea that runs this workflow,
|
|
# <host>/<repository owner>/<name>, for linux/amd64 and linux/arm64, tagged
|
|
# with the version (1.0.0, 1.0) and latest. Desktop installers (Windows NSIS,
|
|
# Linux deb, rpm and AppImage) are attached to the Gitea release for the tag,
|
|
# which is made once every build has passed. Gitea has no hosted Mac runners,
|
|
# so the macOS DMG is built by hand on a Mac (wails3 task darwin:package:dmg
|
|
# in Desktop-App) and attached to the release afterwards.
|
|
#
|
|
# What the Gitea side needs:
|
|
# - Runners with the labels ubuntu-latest (a Docker runner whose jobs can use
|
|
# Docker, for the image builds) and windows-latest (a host runner with Git
|
|
# Bash on the PATH and NSIS or Chocolatey).
|
|
# - Secret REGISTRY_TOKEN: an access token with package write access, for the
|
|
# account in variable REGISTRY_USER (the person who pushed the tag when
|
|
# unset).
|
|
# - Optional variables: REGISTRY (another registry host), DOCS_URL (where
|
|
# Help → Documentation goes in the desktop app), and
|
|
# DESKTOP_UPDATE_MANIFEST_URL with DESKTOP_UPDATE_PUBLIC_KEY (the desktop
|
|
# update feed; without them the build never updates itself, see updates.go).
|
|
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: Version to stamp into the binaries (e.g. 0.1.0-rc1); images are tagged with it
|
|
required: true
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
images:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: docwell-db
|
|
context: Database
|
|
dockerfile: Database/Dockerfile
|
|
- name: docwell-server
|
|
context: .
|
|
dockerfile: Server/Dockerfile
|
|
- name: docwell-web
|
|
context: .
|
|
dockerfile: Web-App/Dockerfile
|
|
- name: docwell
|
|
context: .
|
|
dockerfile: Docker-AIO/Dockerfile
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Version
|
|
id: version
|
|
run: |
|
|
v="${{ inputs.version || github.ref_name }}"
|
|
echo "value=${v#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Gitea's own registry has the server's address. A plain http server
|
|
# means a plain http registry, which BuildKit must be told about.
|
|
- name: Registry
|
|
id: registry
|
|
env:
|
|
REGISTRY: ${{ vars.REGISTRY }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
OWNER: ${{ github.repository_owner }}
|
|
run: |
|
|
host="$REGISTRY"
|
|
http=false
|
|
if [ -z "$host" ]; then
|
|
host="${SERVER_URL#*://}"
|
|
case "$SERVER_URL" in http://*) http=true ;; esac
|
|
fi
|
|
host="${host%/}"
|
|
echo "host=$host" >> "$GITHUB_OUTPUT"
|
|
echo "http=$http" >> "$GITHUB_OUTPUT"
|
|
echo "image=$host/$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')/${{ matrix.name }}" >> "$GITHUB_OUTPUT"
|
|
|
|
# docker login refuses a plain http registry unless the runner's Docker
|
|
# daemon lists it, so the credentials go straight into the client config
|
|
# that buildx reads.
|
|
- name: Registry sign-in
|
|
env:
|
|
HOST: ${{ steps.registry.outputs.host }}
|
|
USERNAME: ${{ vars.REGISTRY_USER || github.actor }}
|
|
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
run: |
|
|
if [ -z "$TOKEN" ]; then
|
|
echo "::error::Set the REGISTRY_TOKEN secret (an access token with package write access)."
|
|
exit 1
|
|
fi
|
|
mkdir -p ~/.docker
|
|
auth=$(printf '%s:%s' "$USERNAME" "$TOKEN" | base64 | tr -d '\n')
|
|
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$HOST" "$auth" > ~/.docker/config.json
|
|
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
with:
|
|
buildkitd-config-inline: |
|
|
[registry."${{ steps.registry.outputs.host }}"]
|
|
http = ${{ steps.registry.outputs.http }}
|
|
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ steps.registry.outputs.image }}
|
|
tags: |
|
|
type=semver,pattern={{version}},value=${{ steps.version.outputs.value }}
|
|
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.value }}
|
|
type=raw,value=${{ steps.version.outputs.value }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
|
type=raw,value=latest,enable=${{ github.event_name == 'push' && !contains(github.ref_name, '-') }}
|
|
labels: |
|
|
org.opencontainers.image.title=${{ matrix.name }}
|
|
org.opencontainers.image.licenses=AGPL-3.0-or-later
|
|
|
|
# The build cache lives next to the image, as its "buildcache" tag.
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: ${{ matrix.context }}
|
|
file: ${{ matrix.dockerfile }}
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
build-args: VERSION=${{ steps.version.outputs.value }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ steps.registry.outputs.image }}:buildcache
|
|
cache-to: type=registry,ref=${{ steps.registry.outputs.image }}:buildcache,mode=max
|
|
|
|
desktop:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows
|
|
runner: windows-latest
|
|
task: windows:package
|
|
files: Desktop-App/bin/*-installer.exe
|
|
- os: linux
|
|
runner: ubuntu-latest
|
|
task: linux:create:deb linux:create:rpm linux:create:appimage
|
|
files: |
|
|
Desktop-App/bin/*.deb
|
|
Desktop-App/bin/*.rpm
|
|
Desktop-App/bin/*.AppImage
|
|
runs-on: ${{ matrix.runner }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
GOWORK: "off"
|
|
# Containers have no FUSE; linuxdeploy unpacks itself instead.
|
|
APPIMAGE_EXTRACT_AND_RUN: "1"
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "1.26"
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
|
|
- name: Version
|
|
id: version
|
|
run: |
|
|
v="${{ inputs.version || github.ref_name }}"
|
|
echo "value=${v#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Linux packaging dependencies
|
|
if: matrix.os == 'linux'
|
|
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libfuse2 rpm
|
|
- name: NSIS
|
|
if: matrix.os == 'windows'
|
|
run: |
|
|
if ! command -v makensis >/dev/null; then
|
|
choco install nsis -y --no-progress
|
|
fi
|
|
echo "C:/Program Files (x86)/NSIS" >> "$GITHUB_PATH"
|
|
- name: Wails CLI
|
|
run: go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0
|
|
|
|
- run: npm ci
|
|
- name: Stamp the version
|
|
working-directory: Desktop-App
|
|
run: node build/set-version.mjs "${{ steps.version.outputs.value }}"
|
|
|
|
- name: Package
|
|
working-directory: Desktop-App
|
|
run: |
|
|
flags="-X main.version=${{ steps.version.outputs.value }}"
|
|
if [ -n "${{ vars.DOCS_URL }}" ]; then
|
|
flags="$flags -X main.docsURL=${{ vars.DOCS_URL }}"
|
|
fi
|
|
if [ -n "${{ vars.DESKTOP_UPDATE_MANIFEST_URL }}" ]; then
|
|
flags="$flags -X main.updateManifestURL=${{ vars.DESKTOP_UPDATE_MANIFEST_URL }} -X main.updatePublicKey=${{ vars.DESKTOP_UPDATE_PUBLIC_KEY }}"
|
|
fi
|
|
wails3 task ${{ matrix.task }} EXTRA_LDFLAGS="$flags"
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: desktop-${{ matrix.os }}
|
|
path: ${{ matrix.files }}
|
|
|
|
release:
|
|
needs: [images, desktop]
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: desktop-*
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
# Gitea's release API; a release made earlier for this tag (by hand or
|
|
# by a rerun) gets the files added instead of a second release.
|
|
- name: Release
|
|
env:
|
|
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
auth="Authorization: token $TOKEN"
|
|
prerelease=false
|
|
case "$TAG" in *-*) prerelease=true ;; esac
|
|
id=$(curl -fsS -H "$auth" "$API/releases/tags/$TAG" | jq -r .id) || id=""
|
|
if [ -z "$id" ]; then
|
|
id=$(jq -n --arg tag "$TAG" --argjson pre "$prerelease" \
|
|
'{tag_name: $tag, name: $tag, prerelease: $pre}' |
|
|
curl -fsS -X POST -H "$auth" -H "Content-Type: application/json" -d @- "$API/releases" | jq -r .id)
|
|
fi
|
|
for f in dist/*; do
|
|
name=$(basename "$f")
|
|
echo "Attaching $name"
|
|
curl -fsS -X POST -H "$auth" -F "attachment=@$f" "$API/releases/$id/assets?name=$name" > /dev/null
|
|
done
|