Run the release workflow on Gitea
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>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-02 15:49:22 +01:00
1 parent 6b6c916825
commit 154fed2a06
3 files changed
+120 -34

No files matched your search

+116 -32
View File
@@ -1,8 +1,23 @@
# Publishes a release: push a tag like v0.1.0.
# Images go to ghcr.io/<repository owner>/<name>, for linux/amd64 and
# linux/arm64, tagged with the version (0.1.0, 0.1) and latest.
# Desktop installers (Windows NSIS, macOS DMG, Linux deb, rpm and AppImage)
# are attached to the GitHub release for the tag.
# 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
@@ -16,7 +31,7 @@ on:
required: true
permissions:
contents: read
contents: write
packages: write
jobs:
@@ -47,18 +62,54 @@ jobs:
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
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
buildkitd-config-inline: |
[registry."${{ steps.registry.outputs.host }}"]
http = ${{ steps.registry.outputs.http }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.name }}
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 }}
@@ -68,6 +119,7 @@ jobs:
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 }}
@@ -77,34 +129,33 @@ jobs:
build-args: VERSION=${{ steps.version.outputs.value }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
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-latest
- os: windows
runner: windows-latest
task: windows:package
files: Desktop-App/bin/*-installer.exe
- os: macos-latest
task: darwin:package:dmg
files: Desktop-App/bin/*.dmg
- os: ubuntu-latest
- 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.os }}
permissions:
contents: write
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
@@ -122,11 +173,15 @@ jobs:
echo "value=${v#v}" >> "$GITHUB_OUTPUT"
- name: Linux packaging dependencies
if: runner.os == 'Linux'
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: runner.os == 'Windows'
run: choco install nsis -y --no-progress && echo "C:/Program Files (x86)/NSIS" >> "$GITHUB_PATH"
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
@@ -135,13 +190,13 @@ jobs:
working-directory: Desktop-App
run: node build/set-version.mjs "${{ steps.version.outputs.value }}"
# The update feed and its ed25519 public key are repository variables;
# without them the build never updates itself (see updates.go).
- name: Package
working-directory: Desktop-App
run: |
flags="-X main.version=${{ steps.version.outputs.value }}"
flags="$flags -X main.docsURL=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
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
@@ -149,10 +204,39 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: desktop-${{ runner.os }}
name: desktop-${{ matrix.os }}
path: ${{ matrix.files }}
- name: Attach to the release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
release:
needs: [images, desktop]
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
files: ${{ matrix.files }}
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