Graduately/.github/workflows/release.yml
pepaskopec-blip 91a848b408 Add a self-updater that installs new releases.
Bake the release tag into the binary so the app knows what it is running;
plain builds keep the "dev" default and never offer an update. The CI
workflow already exported the tag on Linux and macOS, so only the Windows
job needed it.

Read the newest version from the redirect GitHub serves for
/releases/latest, which avoids the REST API and its unauthenticated rate
limit and needs no JSON parser. Networking goes through the curl command
rather than a linked library: curl handles TLS, redirects and proxies, it
ships on all three platforms, and it keeps the bundling scripts free of
another shared library.

An application cannot reliably replace its own files while running, so
every platform follows one shape: unpack beside the current install,
write a script that waits for this process to exit before swapping, then
launch it detached and quit. Staging beside the install keeps the move on
one filesystem and fails early when the location is read-only. The
Windows script copies without mirroring so the progress files kept inside
the install directory survive.

Check quietly a few seconds after startup and offer the result in a
banner above the pages, with a manual check in the settings popover.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 15:04:55 +02:00

127 lines
3 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
linux:
name: Linux AppImage
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential pkg-config curl \
libgtk-4-dev librsvg2-dev \
desktop-file-utils \
appstream
- name: Build AppImage
env:
VERSION: ${{ github.ref_name }}
run: |
chmod +x scripts/bundle-linux.sh
./scripts/bundle-linux.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: maturita-linux
path: dist/maturita-linux-*.AppImage
windows:
name: Windows zip
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
make
zip
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-gtk4
mingw-w64-ucrt-x86_64-pkg-config
mingw-w64-ucrt-x86_64-make
- name: Build and bundle
env:
VERSION: ${{ github.ref_name }}
run: |
make bundle
cd dist
zip -qry ../maturita-windows-x64.zip .
cd ..
mkdir -p dist-out
mv maturita-windows-x64.zip dist-out/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: maturita-windows
path: dist-out/maturita-windows-x64.zip
macos:
name: macOS app
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install gtk4 pkg-config
- name: Build .app zip
env:
VERSION: ${{ github.ref_name }}
run: |
chmod +x scripts/bundle-macos.sh
./scripts/bundle-macos.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: maturita-macos
path: dist/maturita-macos-*.zip
publish:
name: Publish GitHub Release
needs: [linux, windows, macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: List assets
run: find release-assets -type f -print
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
release-assets/maturita-linux-*.AppImage
release-assets/maturita-windows-x64.zip
release-assets/maturita-macos-*.zip
generate_release_notes: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}