CoreDesktop GNOME extension

This commit is contained in:
2026-11-27 12:28:07 -07:00
commit 7d9d2d6239
15 changed files with 1742 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
#
# Purpose : Build gnome-shell-extension-coredesktop from main on Gitea and
# upload it to the [federated] pacman repo, where CoreDesktop's
# update installs it from
#
# Needs GITEA_TOKEN: a Gitea access token with write access to packages
# (Settings > Applications > Generate token, scope "package: Read and write")
# for an account that can publish Federated_Computer's packages.
set -euo pipefail
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# RELEASE_REGISTRY points it at another registry, for testing
REGISTRY="${RELEASE_REGISTRY:-https://gitea.federated.computer/api/packages/Federated_Computer/arch}"
REPO=federated
if [ -z "${GITEA_TOKEN:-}" ]; then
echo "Set GITEA_TOKEN to a Gitea token with write access to packages, e.g.:" >&2
echo " GITEA_TOKEN=... make release" >&2
exit 1
fi
# The package is built from main on Gitea, not from this folder. Say so if
# they differ, so a release doesn't quietly leave out local work.
TOP="$(git -C "$SELF" rev-parse --show-toplevel 2> /dev/null || true)"
if [ -n "$TOP" ]; then
if [ -n "$(git -C "$TOP" status --porcelain --untracked-files=no)" ]; then
echo "Note: you have uncommitted changes. The release is built from main on Gitea, without them."
fi
if git -C "$TOP" fetch --quiet origin main 2> /dev/null \
&& [ "$(git -C "$TOP" rev-parse HEAD)" != "$(git -C "$TOP" rev-parse FETCH_HEAD)" ]; then
echo "Note: this checkout isn't at origin/main. The release is built from origin/main."
fi
fi
OUT="$(mktemp -d)"
trap 'rm -rf "$OUT"' EXIT
echo "Building the package from main..."
# -C starts from a fresh source tree, so nothing from an earlier build gets in
(cd "$SELF" && PKGDEST="$OUT" makepkg --force --cleanbuild)
PKG="$(find "$OUT" -maxdepth 1 -name '*.pkg.tar.zst' | head -n 1)"
if [ -z "$PKG" ]; then
echo "makepkg didn't produce a package." >&2
exit 1
fi
echo "Uploading $(basename "$PKG") to [$REPO]..."
STATUS="$(curl -sS -o "$OUT/response" -w '%{http_code}' -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
--upload-file "$PKG" "$REGISTRY/$REPO")"
case "$STATUS" in
201)
echo "Released $(basename "$PKG"). CoreDesktop's next update installs it."
;;
409)
echo "[$REPO] already has this version. Commit and push a change to main to release a new one." >&2
exit 1
;;
401|403)
echo "Gitea refused the upload ($STATUS): check that GITEA_TOKEN is valid and can write packages." >&2
exit 1
;;
*)
echo "The upload failed with HTTP $STATUS:" >&2
cat "$OUT/response" >&2
echo >&2
exit 1
;;
esac