feat(release): attach native Arch package and repackage for AUR
Update release workflow to detect and attach the native Arch package. Switch the binary AUR recipe to repackage the .pkg.tar.zst. Adjust checksums and packaging steps so the output carries only the native payload without bundling upstream package metadata. - Attach the native .pkg.tar.zst to Gitea releases. - Rework binary AUR recipe to extract usr from the native package. - Update README to document using the native Arch package.
This commit is contained in:
@@ -163,7 +163,7 @@ jobs:
|
||||
ARCH_PACKAGES=(
|
||||
base-devel curl git nodejs npm openssh rust
|
||||
webkit2gtk-4.1 gtk3 hicolor-icon-theme
|
||||
fuse2 libappindicator-gtk3 librsvg xdotool
|
||||
libappindicator-gtk3 librsvg xdotool
|
||||
)
|
||||
|
||||
for ARCH_INSTALL_ATTEMPT in 1 2 3; do
|
||||
@@ -242,15 +242,22 @@ jobs:
|
||||
runuser -u builder -- \
|
||||
bash -lc "cd '$AUR_SOURCE_DIR' && makepkg --cleanbuild --noconfirm && makepkg --printsrcinfo > .SRCINFO"
|
||||
|
||||
echo "AUR_SOURCE_DIR=$AUR_SOURCE_DIR" >> "$GITHUB_ENV"
|
||||
ARCH_PACKAGE_PATH="$(find "$AUR_SOURCE_DIR" -maxdepth 1 -type f -name 'gitty-desktop-*.pkg.tar.zst' -print -quit)"
|
||||
if [ -z "$ARCH_PACKAGE_PATH" ]; then
|
||||
echo "The native Arch package was not created" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Generate and build binary AUR package
|
||||
echo "AUR_SOURCE_DIR=$AUR_SOURCE_DIR" >> "$GITHUB_ENV"
|
||||
echo "ARCH_PACKAGE_PATH=$ARCH_PACKAGE_PATH" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Attach native Arch package to Gitea release
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
TOKEN="${GITEA_TOKEN:-${GITEA_FALLBACK_TOKEN:-}}"
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "A Gitea token is required to download the AppImage" >&2
|
||||
echo "A Gitea token is required to upload the native Arch package" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -258,29 +265,54 @@ jobs:
|
||||
--header "Authorization: token $TOKEN" \
|
||||
"$GITEA_API/repos/$OWNER/$REPO/releases/tags/$RELEASE_TAG")"
|
||||
export RELEASE_JSON
|
||||
APPIMAGE_URL="$(node -e "const r=JSON.parse(process.env.RELEASE_JSON); const a=(r.assets || []).find(a => String(a.name || '').toLowerCase().endsWith('.appimage')); if (!a?.browser_download_url) process.exit(1); process.stdout.write(a.browser_download_url)")"
|
||||
APPIMAGE_NAME="$(node -e "const r=JSON.parse(process.env.RELEASE_JSON); const a=(r.assets || []).find(a => String(a.name || '').toLowerCase().endsWith('.appimage')); if (!a?.name) process.exit(1); process.stdout.write(a.name)")"
|
||||
RELEASE_ID="$(node -e "const r=JSON.parse(process.env.RELEASE_JSON); if (!r.id) process.exit(1); process.stdout.write(String(r.id))")"
|
||||
PACKAGE_NAME="${ARCH_PACKAGE_PATH##*/}"
|
||||
export PACKAGE_NAME
|
||||
|
||||
if node -e "const r=JSON.parse(process.env.RELEASE_JSON); process.exit((r.assets || []).some(a => a.name === process.env.PACKAGE_NAME) ? 0 : 1)"; then
|
||||
echo "Release asset $PACKAGE_NAME already exists; skipping upload."
|
||||
else
|
||||
curl --fail --location --silent --show-error \
|
||||
--request POST \
|
||||
--header "Authorization: token $TOKEN" \
|
||||
--form "attachment=@$ARCH_PACKAGE_PATH;type=application/octet-stream" \
|
||||
"$GITEA_API/repos/$OWNER/$REPO/releases/$RELEASE_ID/assets?name=$PACKAGE_NAME"
|
||||
echo
|
||||
echo "Attached $PACKAGE_NAME to Gitea release $RELEASE_TAG."
|
||||
fi
|
||||
|
||||
- name: Generate and build binary AUR package
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
TOKEN="${GITEA_TOKEN:-${GITEA_FALLBACK_TOKEN:-}}"
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "A Gitea token is required to locate the native Arch package" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_JSON="$(curl --fail --location --silent --show-error \
|
||||
--header "Authorization: token $TOKEN" \
|
||||
"$GITEA_API/repos/$OWNER/$REPO/releases/tags/$RELEASE_TAG")"
|
||||
export RELEASE_JSON
|
||||
PACKAGE_NAME="${ARCH_PACKAGE_PATH##*/}"
|
||||
export PACKAGE_NAME
|
||||
PACKAGE_URL="$(node -e "const r=JSON.parse(process.env.RELEASE_JSON); const a=(r.assets || []).find(a => a.name === process.env.PACKAGE_NAME); if (!a?.browser_download_url) process.exit(1); process.stdout.write(a.browser_download_url)")"
|
||||
|
||||
AUR_BIN_DIR="$(mktemp -d)"
|
||||
cp PKGBUILD-bin "$AUR_BIN_DIR/PKGBUILD"
|
||||
APPIMAGE_PATH="$AUR_BIN_DIR/$APPIMAGE_NAME"
|
||||
PACKAGE_PATH="$AUR_BIN_DIR/$PACKAGE_NAME"
|
||||
curl --fail --location --silent --show-error \
|
||||
--header "Authorization: token $TOKEN" \
|
||||
--output "$APPIMAGE_PATH" "$APPIMAGE_URL"
|
||||
APPIMAGE_CHECKSUM="$(sha256sum "$APPIMAGE_PATH" | cut -d ' ' -f 1)"
|
||||
ICON_PATH="$AUR_BIN_DIR/gitty-desktop.png"
|
||||
curl --fail --location --silent --show-error \
|
||||
--output "$ICON_PATH" \
|
||||
"https://git.cbsk-tech.de/Christoph/GitLite/raw/tag/$RELEASE_TAG/src-tauri/icons/icon.png"
|
||||
ICON_CHECKSUM="$(sha256sum "$ICON_PATH" | cut -d ' ' -f 1)"
|
||||
--output "$PACKAGE_PATH" "$PACKAGE_URL"
|
||||
PACKAGE_CHECKSUM="$(sha256sum "$PACKAGE_PATH" | cut -d ' ' -f 1)"
|
||||
|
||||
sed -i \
|
||||
-e "s/^pkgver=.*/pkgver=$PACKAGE_VERSION/" \
|
||||
-e "s/^pkgrel=.*/pkgrel=1/" \
|
||||
-e "s|^_appimage=.*|_appimage=\"$APPIMAGE_NAME\"|" \
|
||||
-e "s|^_artifact_url=.*|_artifact_url=\"$APPIMAGE_URL\"|" \
|
||||
-e "s/^_tag=.*/_tag=$RELEASE_TAG/" \
|
||||
-e "/^sha256sums=/,/^[[:space:]]*'SKIP')$/c\\sha256sums=('$APPIMAGE_CHECKSUM'\\n '$ICON_CHECKSUM')" \
|
||||
-e "s|^_package=.*|_package=\"$PACKAGE_NAME\"|" \
|
||||
-e "s|^_artifact_url=.*|_artifact_url=\"$PACKAGE_URL\"|" \
|
||||
-e "s/^sha256sums=.*/sha256sums=('$PACKAGE_CHECKSUM')/" \
|
||||
"$AUR_BIN_DIR/PKGBUILD"
|
||||
|
||||
chown -R builder:builder "$AUR_BIN_DIR"
|
||||
|
||||
Reference in New Issue
Block a user