-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·59 lines (52 loc) · 2.64 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·59 lines (52 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
#
# Build the signed flatpak repo from the current source tree and publish it to the
# gh-pages branch (served by GitHub Pages at https://ferose.github.io/SplitKeyboard/).
# Users install/update from there via splitkeyboard.flatpakref.
#
# This only rebuilds + republishes the *binary* repo. Commit and push your source
# changes to `main` separately first.
#
# Requires: the repo signing key in your GPG keyring (override the id with
# SPLITKB_GPG_KEYID=...), and a clone of the gh-pages branch at $GHPAGES with a
# `github` remote (git clone, git checkout gh-pages).
#
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
KEYID="${SPLITKB_GPG_KEYID:-92C51F7D6B33B3D7}"
APP_ID="online.ferose.SplitKeyboard"
MANIFEST="$REPO_ROOT/$APP_ID.yml"
# Build outputs must share a filesystem with the .flatpak-builder state dir (the repo),
# so keep them under $HOME rather than /tmp.
OSTREE_REPO="${SPLITKB_OSTREE_REPO:-$HOME/splitkb-pages-repo}"
BUILD_DIR="${SPLITKB_BUILD_DIR:-$HOME/splitkb-pages-build}"
GHPAGES="${SPLITKB_GHPAGES:-$HOME/splitkb-ghpages}"
echo ">> building the repo from $MANIFEST"
cd "$REPO_ROOT"
# Do NOT pass --gpg-sign to flatpak-builder. Signing *inside* the org.flatpak.Builder sandbox
# spawns a gpg-agent/keyboxd daemon that never exits, and bwrap waits for every descendant --
# so the build hangs forever in wait() after it has otherwise finished. Build unsigned here,
# then sign on the host below, where a lingering agent is harmless.
flatpak run org.flatpak.Builder --force-clean --user --install-deps-from=flathub --ccache \
--repo="$OSTREE_REPO" "$BUILD_DIR" "$MANIFEST"
echo ">> signing the repo (commits + summary) on the host"
# build-sign signs each ref's latest *commit* (the .Debug is a runtime ref, hence --runtime);
# build-update-repo's --gpg-sign signs only the *summary*. Both are needed for a flatpakref
# install with a GPGKey to verify.
flatpak build-sign --gpg-sign="$KEYID" "$OSTREE_REPO" "$APP_ID"
flatpak build-sign --runtime --gpg-sign="$KEYID" "$OSTREE_REPO" "$APP_ID.Debug"
flatpak build-update-repo --gpg-sign="$KEYID" "$OSTREE_REPO"
echo ">> syncing the repo into the gh-pages working copy ($GHPAGES)"
[ -d "$GHPAGES/.git" ] || { echo "!! $GHPAGES is not a git clone of the gh-pages branch"; exit 1; }
rm -rf "$GHPAGES/repo"
cp -r "$OSTREE_REPO" "$GHPAGES/repo"
echo ">> committing + pushing gh-pages"
cd "$GHPAGES"
git add -A
if git diff --cached --quiet; then
echo ">> nothing changed; repo already up to date"
exit 0
fi
git commit -q -m "Update flatpak repo ($(date -u +%Y-%m-%d))"
git push github gh-pages
echo ">> published. Users update with: flatpak update online.ferose.SplitKeyboard"