carrier/.forgejo/workflows/release.yml
randogoth 2d18caa500
Some checks failed
Release / macos (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / release (push) Has been cancelled
CI / macos (push) Has been cancelled
CI / linux (push) Has been cancelled
Add Flatpak bundle to the release workflow
Builds carrier-x86_64.flatpak from the linux job's already-built binary
rather than recompiling inside flatpak-builder's sandbox (which can't
see the shared cargo cache anyway, making an in-sandbox build pure
duplicate work). com.randogoth.carrier.release.json is a separate
manifest from the main one, which stays as-is for local
`devbox run package` dev-from-source builds.
2026-10-07 20:39:57 +03:00

125 lines
4.5 KiB
YAML

name: Release
on:
push:
tags: ["v*"]
jobs:
macos:
runs-on: macos-arm64
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
path: carrier
- uses: https://code.forgejo.org/actions/checkout@v4
with:
repository: randogoth/fumi
ref: main
path: fumi
- uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.cargo/registry
carrier/target
fumi/target
key: cargo-macos-${{ hashFiles('carrier/Cargo.lock') }}
restore-keys: cargo-macos-
- run: devbox run build
working-directory: carrier
env:
GITHUB_TOKEN: ""
- run: mv target/release/carrier target/release/carrier-macos-arm64
working-directory: carrier
# actions/upload-artifact@v4 talks the newer Artifacts-v2 protocol,
# which Forgejo's server rejects ("not currently supported on GHES").
# forgejo/upload-artifact is Forgejo's own patched fork with that
# check disabled - needed on both upload and download ends.
- uses: https://code.forgejo.org/forgejo/upload-artifact@v5
with:
name: carrier-macos-arm64
path: carrier/target/release/carrier-macos-arm64
linux:
runs-on: linux-x86_64
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
path: carrier
- uses: https://code.forgejo.org/actions/checkout@v4
with:
repository: randogoth/fumi
ref: main
path: fumi
- uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.cargo/registry
carrier/target
fumi/target
key: cargo-linux-${{ hashFiles('carrier/Cargo.lock') }}
restore-keys: cargo-linux-
- run: devbox run build
working-directory: carrier
env:
GITHUB_TOKEN: ""
- run: mv target/release/carrier target/release/carrier-linux-x86_64
working-directory: carrier
- uses: https://code.forgejo.org/forgejo/upload-artifact@v5
with:
name: carrier-linux-x86_64
path: carrier/target/release/carrier-linux-x86_64
# Packages the linux job's already-built binary instead of recompiling
# inside flatpak-builder's own sandbox: that sandbox copies the source
# tree in fresh, so it never sees ~/.cargo/registry or target/, making an
# in-sandbox cargo build fully redundant with the linux job's build.
# com.randogoth.carrier.release.json (not the main manifest, which is
# still used by local `devbox run package` for from-source dev builds)
# just installs this prebuilt binary instead of invoking cargo.
flatpak:
needs: [linux]
runs-on: linux-x86_64
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
path: carrier
- uses: https://code.forgejo.org/forgejo/download-artifact@v7
with:
name: carrier-linux-x86_64
path: carrier
- run: chmod +x carrier-linux-x86_64
working-directory: carrier
- run: devbox run bundle-flatpak
working-directory: carrier
env:
GITHUB_TOKEN: ""
- uses: https://code.forgejo.org/forgejo/upload-artifact@v5
with:
name: carrier-x86_64.flatpak
path: carrier/carrier-x86_64.flatpak
# forgejo-release.sh (the engine behind actions/forgejo-release) always
# does a blind create-then-upload of the release for the tag, with no
# check for one already existing - running it from two parallel jobs
# against the same tag either hard-fails the second create (override:
# false) or races a delete-and-recreate that can wipe out the first job's
# just-uploaded assets (override: true). So platform jobs only ever
# produce artifacts; exactly one job, gated on both finishing, does the
# single release create + upload.
release:
needs: [macos, linux, flatpak]
runs-on: linux-x86_64
steps:
- uses: https://code.forgejo.org/forgejo/download-artifact@v7
with:
path: dist/release
merge-multiple: true
- uses: https://code.forgejo.org/actions/forgejo-release@v2.13.4
with:
direction: upload
release-dir: dist/release
# Safe here specifically because this is the only job that ever
# calls forgejo-release for a given tag: re-running this same job
# for the same tag (e.g. a manual rerun) replaces its release
# cleanly instead of failing on "already exists".
override: true