mirror of
https://github.com/pepaskopec-blip/Graduately.git
synced 2026-10-27 15:14:35 +00:00
Releases and version numbers are gone. CI now rebuilds all three platforms on every change to main and commits the packages to the `builds` branch, so what anyone downloads is the current state of the repository. The branch is rewritten from scratch each time rather than added to, so the repository keeps one copy of the packages instead of a ~70 MB set per commit. Without tags there is no version to compare, so a build carries the commit it was made from and the branch carries a VERSION file naming the same commit. The updater fetches those few bytes and treats any difference as being behind; commits are not ordered, and the branch only ever holds the current build. The installers fetch from the branch over raw.githubusercontent.com for the same reason. Co-authored-by: Cursor <cursoragent@cursor.com>
150 lines
4 KiB
YAML
150 lines
4 KiB
YAML
name: Build
|
|
|
|
# Packages are published to the `builds` branch instead of to a GitHub
|
|
# Release, so everything the installers and the in-app updater fetch comes
|
|
# straight from the repository and always matches what is on main.
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
# Nothing to rebuild when only documentation changed.
|
|
paths-ignore:
|
|
- "README.md"
|
|
- "LICENSE"
|
|
- ".gitignore"
|
|
workflow_dispatch:
|
|
|
|
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:
|
|
COMMIT: ${{ github.sha }}
|
|
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:
|
|
COMMIT: ${{ github.sha }}
|
|
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:
|
|
COMMIT: ${{ github.sha }}
|
|
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 to builds branch
|
|
needs: [linux, windows, macos]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: staged
|
|
merge-multiple: true
|
|
|
|
- name: Collect installers
|
|
run: |
|
|
cp installers/maturita-installer-linux.sh staged/
|
|
cp installers/maturita-installer-windows.cmd staged/
|
|
chmod +x installers/maturita-installer-macos.command
|
|
(cd installers && zip -q ../staged/maturita-installer-macos.zip \
|
|
maturita-installer-macos.command)
|
|
# The updater downloads this to see whether it is behind.
|
|
echo "${{ github.sha }}" > staged/VERSION
|
|
|
|
# The branch is rewritten from scratch every time rather than added to,
|
|
# so the repository keeps one copy of the packages instead of a new
|
|
# ~70 MB set per commit.
|
|
- name: Push to builds branch
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
rm -rf .git/index.lock
|
|
git checkout --orphan builds
|
|
git rm -rf --cached . >/dev/null
|
|
find . -maxdepth 1 ! -name . ! -name .git ! -name staged \
|
|
-exec rm -rf {} +
|
|
mv staged/* .
|
|
rmdir staged
|
|
ls -la
|
|
git add -A
|
|
git commit -q -m "Build from ${{ github.sha }}"
|
|
git push -f origin builds
|