Skip to content

Commit 7f750d9

Browse files
committed
Fix Flatpak branch stability for updates
1 parent 73203bf commit 7f750d9

4 files changed

Lines changed: 32 additions & 11 deletions

File tree

.github/workflows/build-cryptad-flatpak.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
description: "Resolved version used for this build"
2929
value: ${{ jobs.build.outputs.version }}
3030

31+
env:
32+
FLATPAK_BRANCH: stable
33+
3134
jobs:
3235
build:
3336
runs-on: ${{ matrix.runner }}
@@ -89,12 +92,12 @@ jobs:
8992
__VERSION__=${{ steps.prepare.outputs.version }}
9093
preview_lines: "120"
9194

92-
- name: Install Flatpak tooling and runtimes
95+
- name: Install Flatpak tooling, yq, and runtimes
9396
run: |
9497
set -euo pipefail
95-
echo "::group::Install flatpak + flatpak-builder"
98+
echo "::group::Install flatpak + flatpak-builder + yq"
9699
sudo apt-get update
97-
sudo apt-get install -y flatpak flatpak-builder
100+
sudo apt-get install -y flatpak flatpak-builder yq
98101
echo "::endgroup::"
99102
echo "::group::Configure flathub remote"
100103
# Add flathub to the user installation (match --user usage later)
@@ -105,6 +108,16 @@ jobs:
105108
flatpak --user --noninteractive install -y flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
106109
echo "::endgroup::"
107110
111+
- name: Verify rendered Flatpak branch
112+
run: |
113+
set -euo pipefail
114+
ACTUAL_BRANCH="$(yq -r '.branch' flatpak/cryptad.yaml)"
115+
if [ "$ACTUAL_BRANCH" != "$FLATPAK_BRANCH" ]; then
116+
echo "::error::Expected Flatpak manifest branch '$FLATPAK_BRANCH' but found '$ACTUAL_BRANCH'"
117+
exit 1
118+
fi
119+
echo "::notice::Verified Flatpak manifest branch: $ACTUAL_BRANCH"
120+
108121
- name: Build Flatpak (manifest)
109122
env:
110123
FLATPAK_DEFAULT_ARCH: ${{ matrix.flatpak_arch }}
@@ -122,16 +135,23 @@ jobs:
122135
set -euo pipefail
123136
VERSION='${{ steps.prepare.outputs.version }}'
124137
APPID='network.crypta.cryptad'
125-
BRANCH="v${VERSION}"
138+
BRANCH="${FLATPAK_BRANCH}"
126139
# Canonical arch naming for artifact filenames
127140
case "${{ matrix.flatpak_arch }}" in
128141
x86_64) CANON_ARCH=amd64 ;;
129142
aarch64) CANON_ARCH=arm64 ;;
130143
*) CANON_ARCH='${{ matrix.flatpak_arch }}' ;;
131144
esac
132145
echo "::group::Export repo"
133-
# Export to the same branch we'll bundle (defaults to 'master' if omitted)
146+
# Export to the same stable branch we'll bundle so all releases share one ref.
134147
flatpak build-export --arch=${{ matrix.flatpak_arch }} repo builddir "$BRANCH"
148+
EXPECTED_REF="app/${APPID}/${{ matrix.flatpak_arch }}/${BRANCH}"
149+
if ! ostree refs --repo=repo | grep -Fx "$EXPECTED_REF" >/dev/null; then
150+
echo "::error::Expected exported Flatpak ref '$EXPECTED_REF' was not created"
151+
ostree refs --repo=repo | sed 's/^/::error::[ref] /'
152+
exit 1
153+
fi
154+
echo "::notice::Verified exported Flatpak ref: $EXPECTED_REF"
135155
echo "::endgroup::"
136156
echo "::group::Create bundle"
137157
BUNDLE="cryptad-v${VERSION}-${CANON_ARCH}.flatpak"

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Diagnostics:
119119
Path: `flatpak/cryptad.yaml.template`
120120

121121
Key points:
122-
- `id: network.crypta.cryptad`, `branch: v__VERSION__`.
122+
- `id: network.crypta.cryptad`, `branch: stable`.
123123
- `runtime: org.freedesktop.Platform`, `runtime-version: '24.08'`, `sdk: org.freedesktop.Sdk`.
124124
- `command: cryptad-launcher` (GUI entry) with `finish-args` for network, wayland/x11, IPC, DRI, and `env: CRYPTAD_ALLOW_ROOT=1`.
125125
- Single `modules` entry unpacks `cryptad-jlink-v__VERSION__.tar.gz` to `/app` with `--strip-components=1` to ensure `/app/bin/cryptad` exists.
@@ -161,11 +161,12 @@ High‑level flow:
161161
4) Build upstream dist; write absolute tarball path to `.tarball-path`.
162162
5) Repack payload to `flatpak/local/cryptad-jlink-v<version>.tar.gz`.
163163
6) Render `flatpak/cryptad.yaml` and `flatpak/network.crypta.cryptad.metainfo.xml` from templates.
164+
- Assert with `yq` that the rendered manifest branch is `stable`.
164165
7) Render shared desktop file (`Exec=cryptad-launcher`, `Icon=network.crypta.cryptad`).
165166
8) Install Flatpak tooling; add Flathub remote to the user scope; install freedesktop runtime+SDK 24.08.
166167
9) Build with `flatpak-builder --user --arch=<matrix>`.
167-
10) Export repo to branch `v<version>` and bundle as `cryptad-flatpak-v<version>-<arch>.flatpak`.
168-
11) Upload artifact per arch: `cryptad-flatpak-<version>-x86_64` or `...-aarch64`.
168+
10) Export repo to branch `stable`, verify the exported ref, and bundle as `cryptad-v<version>-<arch>.flatpak`.
169+
11) Upload artifact per arch: `cryptad-flatpak-<version>-amd64` or `...-arm64`.
169170

170171
## Rationale and Lessons Learned
171172

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Artifacts:
111111
## Flatpak (Freedesktop 24.08)
112112

113113
Template: `flatpak/cryptad.yaml.template`
114-
- `id: network.crypta.cryptad`, `branch: v__VERSION__`
114+
- `id: network.crypta.cryptad`, `branch: stable`
115115
- Runtime/SDK: `org.freedesktop.Platform` / `org.freedesktop.Sdk` (24.08)
116116
- GUI command: `cryptad-launcher`; `finish-args` include network, wayland/x11,
117117
IPC/DRI, and `CRYPTAD_ALLOW_ROOT=1`
@@ -120,7 +120,7 @@ Template: `flatpak/cryptad.yaml.template`
120120
- Installs desktop file and 512×512 hicolor icon, plus AppStream metadata
121121

122122
The workflow installs Flatpak tooling, adds Flathub to the user scope, installs
123-
freedesktop 24.08 runtime+SDK, builds, exports branch `v<version>`, and bundles.
123+
freedesktop 24.08 runtime+SDK, builds, exports branch `stable`, and bundles.
124124

125125
Artifacts:
126126
- GitHub artifact names: `cryptad-flatpak-<version>-amd64`, `cryptad-flatpak-<version>-arm64`

flatpak/cryptad.yaml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
id: network.crypta.cryptad
2-
branch: v__VERSION__
2+
branch: stable
33
runtime: org.freedesktop.Platform
44
runtime-version: '24.08'
55
sdk: org.freedesktop.Sdk

0 commit comments

Comments
 (0)