Use Forgejo runners for release builds
Some checks failed
Release / Build Linux (push) Has been cancelled
Release / Build macOS (push) Has been cancelled

This commit is contained in:
Daniel 2026-05-15 16:39:18 +02:00
parent 6104851b8e
commit 0076b37a23
4 changed files with 34 additions and 16 deletions

View file

@ -7,9 +7,21 @@ on:
workflow_dispatch:
jobs:
linux-release:
name: Build Linux Release
runs-on: ubuntu-latest
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
runner: ubuntu-latest
command: npm run dist:linux -- --publish never
artifacts: "release/*.AppImage release/*.deb"
- name: macOS
runner: macos-latest
command: npm run dist:mac -- --publish never
artifacts: "release/*.dmg release/*.zip"
steps:
- name: Checkout
@ -24,10 +36,10 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build Linux packages
run: npm run dist:linux -- --publish never
- name: Build packages
run: ${{ matrix.command }}
- name: Create Forgejo release
- name: Create or find Forgejo release
if: startsWith(github.ref, 'refs/tags/v')
env:
FORGEJO_TOKEN: ${{ github.token }}
@ -36,11 +48,16 @@ jobs:
TAG: ${{ github.ref_name }}
run: |
set -eu
response=$(curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases" \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"main\",\"name\":\"$TAG\",\"body\":\"Automated Linux desktop build.\",\"draft\":false,\"prerelease\":false}")
release_id=$(node -e "const data = JSON.parse(process.argv[1]); if (!data.id) throw new Error(JSON.stringify(data)); console.log(data.id)" "$response")
response=$(curl -sS "$FORGEJO_API/repos/$REPO/releases/tags/$TAG" \
-H "Authorization: token $FORGEJO_TOKEN")
release_id=$(node -e "const data = JSON.parse(process.argv[1]); console.log(data.id || '')" "$response")
if [ -z "$release_id" ]; then
response=$(curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases" \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"main\",\"name\":\"$TAG\",\"body\":\"Automated desktop builds from Forgejo runners.\",\"draft\":false,\"prerelease\":false}")
release_id=$(node -e "const data = JSON.parse(process.argv[1]); if (!data.id) throw new Error(JSON.stringify(data)); console.log(data.id)" "$response")
fi
echo "release_id=$release_id" >> "$GITHUB_ENV"
- name: Upload release assets
@ -49,9 +66,10 @@ jobs:
FORGEJO_TOKEN: ${{ github.token }}
FORGEJO_API: https://git.danvics.com/api/v1
REPO: ${{ github.repository }}
ARTIFACTS: ${{ matrix.artifacts }}
run: |
set -eu
for artifact in release/*.AppImage release/*.deb; do
for artifact in $ARTIFACTS; do
[ -f "$artifact" ] || continue
name=$(basename "$artifact")
curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases/$release_id/assets?name=$name" \

View file

@ -34,7 +34,7 @@ macOS DMG builds must run on macOS because the DMG toolchain and `dmg-license` d
## CI Releases
GitHub Actions builds release artifacts on native runners for Linux, Windows, and macOS. Push a version tag to publish artifacts to a GitHub Release:
Forgejo Actions builds release artifacts on registered runners. The Linux job uses the existing `ubuntu-latest` runner; the macOS job expects a Forgejo runner registered with the `macos-latest` label so it can build DMG/zip artifacts natively. Push a version tag to publish artifacts to a Forgejo Release:
```bash
git tag v0.1.0

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "nextcloud-notes-desktop",
"version": "0.1.1",
"version": "0.1.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "nextcloud-notes-desktop",
"version": "0.1.1",
"version": "0.1.2",
"dependencies": {
"react": "^19.2.6",
"react-dom": "^19.2.6",

View file

@ -1,6 +1,6 @@
{
"name": "nextcloud-notes-desktop",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"description": "Fast cross-platform desktop client for Nextcloud Notes",
"author": {