diff --git a/packaging/aur/scripts/release.sh b/packaging/aur/scripts/release.sh index be07391db6e7f..c4b6b52168e83 100755 --- a/packaging/aur/scripts/release.sh +++ b/packaging/aur/scripts/release.sh @@ -8,8 +8,10 @@ pkgrel="${PKGREL:-1}" if [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then pkgname='t3code-bin' + asset_name='T3-Code-x86_64.AppImage' elif [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-nightly\.[0-9]{8}\.[0-9]+$ ]]; then pkgname='t3code-nightly-bin' + asset_name='T3-Code-Nightly-x86_64.AppImage' else echo "Release $tag does not publish an AUR package." exit 0 @@ -17,14 +19,17 @@ fi version="${tag#v}" pkgver="${version//-/_}" -asset_name="T3-Code-${version}-x86_64.AppImage" release_json="$(gh api "repos/$repo/releases/tags/$tag")" -asset_digest="$(jq -r --arg name "$asset_name" \ - '.assets[] | select(.name == $name) | .digest' <<<"$release_json")" -appimage_sha256="${asset_digest#sha256:}" +# Older releases publish the AppImage under a versioned name. +for asset_name in "$asset_name" "T3-Code-${version}-x86_64.AppImage"; do + asset_digest="$(jq -r --arg name "$asset_name" \ + '.assets[] | select(.name == $name) | .digest' <<<"$release_json")" + appimage_sha256="${asset_digest#sha256:}" + [[ "$appimage_sha256" =~ ^[0-9a-f]{64}$ ]] && break +done if [[ ! "$appimage_sha256" =~ ^[0-9a-f]{64}$ ]]; then - echo "Release $tag is missing $asset_name or its SHA-256 digest." >&2 + echo "Release $tag is missing its x86_64 AppImage or its SHA-256 digest." >&2 exit 1 fi @@ -39,6 +44,7 @@ cd "$package_dir" sed -Ei \ -e "s/^pkgver=.*/pkgver=$pkgver/" \ -e "s/^pkgrel=.*/pkgrel=$pkgrel/" \ + -e "s/^_asset=.*/_asset='$asset_name'/" \ -e "/# AppImage$/s/'[0-9a-f]{64}'/'$appimage_sha256'/" \ -e "/# upstream license$/s/'[0-9a-f]{64}'/'$license_sha256'/" \ PKGBUILD diff --git a/packaging/aur/t3code-bin/PKGBUILD b/packaging/aur/t3code-bin/PKGBUILD index c5219666bf08b..b15e44d45b44d 100644 --- a/packaging/aur/t3code-bin/PKGBUILD +++ b/packaging/aur/t3code-bin/PKGBUILD @@ -44,8 +44,9 @@ conflicts=('t3code') options=('!debug' '!strip') _appimage="T3-Code-${pkgver}-x86_64.AppImage" +_asset="$_appimage" source=( - "$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${pkgver}/$_appimage" + "$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${pkgver}/$_asset" "${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${pkgver}/LICENSE" ) sha256sums=( diff --git a/packaging/aur/t3code-nightly-bin/PKGBUILD b/packaging/aur/t3code-nightly-bin/PKGBUILD index f3b61c7d5223e..69839d2661565 100644 --- a/packaging/aur/t3code-nightly-bin/PKGBUILD +++ b/packaging/aur/t3code-nightly-bin/PKGBUILD @@ -45,8 +45,9 @@ options=('!debug' '!strip') _upstream_version="${pkgver/_nightly./-nightly.}" _appimage="T3-Code-${_upstream_version}-x86_64.AppImage" +_asset="$_appimage" source=( - "$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${_upstream_version}/$_appimage" + "$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${_upstream_version}/$_asset" "${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${_upstream_version}/LICENSE" ) sha256sums=( diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts index aef49abea7c63..db9cd99c115ef 100644 --- a/scripts/build-desktop-artifact.test.ts +++ b/scripts/build-desktop-artifact.test.ts @@ -574,6 +574,29 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { }), ); + // electron-updater keeps the installed AppImage path only when its name has no x.y.z version. + it.effect("names updatable AppImages without a version and apart per channel", () => + Effect.gen(function* () { + const appImageName = (version: string) => + createBuildConfig("linux", "AppImage", version, false, false, undefined, undefined).pipe( + Effect.map((config) => (config.appImage as { artifactName: string }).artifactName), + ); + + const stable = yield* appImageName("0.0.37"); + const nightly = yield* appImageName("0.0.38-nightly.20261026.3740"); + + assert.notInclude(stable, "${version}"); + assert.notInclude(nightly, "${version}"); + assert.notEqual(stable, nightly); + }).pipe( + Effect.provide( + ConfigProvider.layer( + ConfigProvider.fromEnv({ env: { GITHUB_REPOSITORY: "pingdotgg/t3code" } }), + ), + ), + ), + ); + // pnpm writes "set this to true or false" placeholders into allowBuilds when a // tarball changes. pnpm ignores them, but the release build decode rejects them. it.effect("decodes the repo allowBuilds and every file: tarball it names exists", () => diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index 2fff4919c40d3..44e1c3e807365 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -2925,6 +2925,13 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( }, }, }; + // electron-updater replaces an installed AppImage in place only when its name has no x.y.z version. + if (buildConfig.publish) { + buildConfig.appImage = { + artifactName: + updateChannel === "nightly" ? "T3-Code-Nightly-${arch}.${ext}" : "T3-Code-${arch}.${ext}", + }; + } buildConfig.deb = { // FPM runs outside the staged app directory, so source paths must be absolute. fpm: [