CI / go (Server) (push) Successful in 12m44s
CI / go (Web-App) (push) Successful in 10m14s
CI / frontend (push) Successful in 11m15s
CI / desktop (ubuntu-latest) (push) Successful in 33m54s
CI / mobile (push) Failing after 26s
CI / docker (push) Successful in 4m0s
Docs / build (push) Successful in 10m21s
Docs / deploy (push) Skipped
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Release / desktop (Desktop-App/bin/*-installer.exe, windows, windows-latest, windows:package) (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / images (., Docker-AIO/Dockerfile, docwell) (push) Failing after 26s
Release / images (., Server/Dockerfile, docwell-server) (push) Failing after 29s
Release / images (., Web-App/Dockerfile, docwell-web) (push) Failing after 28s
Release / images (Database, Database/Dockerfile, docwell-db) (push) Failing after 22s
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) Successful in 27m3s
Version 4 of upload-artifact and download-artifact stops on any server other than github.com, so the release moves the desktop installers between jobs with v3, which Gitea supports. v3 downloads every artifact into its own folder, so the release step attaches dist/*/*. The docs workflow only uploads and deploys on GitHub, where Pages exists; on Gitea it checks that the site builds. 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@v4
|
|
|
|
- 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@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.26"
|
|
- uses: actions/setup-node@v4
|
|
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-4-dev libwebkitgtk-6.0-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"
|
|
|
|
# v3: v4 of the artifact actions refuses to run outside github.com.
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: desktop-${{ matrix.os }}
|
|
path: ${{ matrix.files }}
|
|
|
|
release:
|
|
needs: [images, desktop]
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Each artifact lands in dist/<artifact name>/.
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
path: dist
|
|
|
|
# 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
|