gdevelop: added update script, 5.5.229 -> 5.5.231 (#410318)

This commit is contained in:
Matteo Pacini 2025-05-24 00:13:53 +01:00 committed by GitHub
commit a61befb69a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 4 deletions

View file

@ -6,13 +6,19 @@
pname,
version,
meta,
passthru,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
inherit pname version meta;
inherit
pname
version
meta
passthru
;
src = fetchurl {
url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}-universal-mac.zip";
hash = "sha256-0FT4JHGJKy6UapuV2tXKzWm0Esr6DPqu38PllUbUtrY=";
hash = "sha256-zvPum8vTEXS0LbwBpzGNmcsm3s7u2oAJBhGYvlV1PWw=";
};
sourceRoot = ".";

View file

@ -6,13 +6,14 @@
version,
pname,
meta,
passthru,
}:
let
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}.AppImage";
hash = "sha256-KV6gzPiu/45ibdzMG707vd10F6qLcm+afwJWa6WlywU=";
hash = "sha256-RjpiIy4NqZ9QCevwWR6cKLobbsFjneq+Vhr/t0JfvgU=";
}
else
throw "${pname}-${version} is not supported on ${stdenv.hostPlatform.system}";
@ -29,6 +30,7 @@ appimageTools.wrapType2 {
version
src
meta
passthru
;
extraInstallCommands = ''

View file

@ -5,7 +5,7 @@
...
}:
let
version = "5.5.229";
version = "5.5.231";
pname = "gdevelop";
meta = {
description = "Graphical Game Development Studio";
@ -20,6 +20,7 @@ let
mainProgram = "gdevelop";
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
};
passthru.updateScript = ./update.sh;
in
if stdenv.hostPlatform.isDarwin then
callPackage ./darwin.nix {
@ -27,6 +28,7 @@ if stdenv.hostPlatform.isDarwin then
pname
version
meta
passthru
;
}
else
@ -35,5 +37,6 @@ else
pname
version
meta
passthru
;
}

View file

@ -0,0 +1,33 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq gnused
set -euo pipefail
cd "$(dirname "$0")" || exit 1
# Grab latest version from the GitHub repository
LATEST_VER="$(curl --fail -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/4ian/GDevelop/releases" | jq -r '.[0].tag_name' | sed 's/^v//')"
CURRENT_VER="$(grep -oP 'version = "\K[^"]+' package.nix)"
if [[ "$LATEST_VER" == "$CURRENT_VER" ]]; then
echo "gdevelop is up-to-date"
exit 0
fi
echo "Updating gdevelop from $CURRENT_VER to $LATEST_VER"
# Update the version
sed -i "s#version = \".*\";#version = \"$LATEST_VER\";#g" package.nix
# Update hashes
# - Linux
LINUX_HASH="$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --type sha256 "https://github.com/4ian/GDevelop/releases/download/v${LATEST_VER}/GDevelop-5-${LATEST_VER}.AppImage")")"
sed -i "s#hash = \".*\"#hash = \"$LINUX_HASH\"#g" linux.nix
# - Darwin
DARWIN_HASH="$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --type sha256 "https://github.com/4ian/GDevelop/releases/download/v${LATEST_VER}/GDevelop-5-${LATEST_VER}-universal-mac.zip")")"
sed -i "s#hash = \".*\"#hash = \"$DARWIN_HASH\"#g" darwin.nix
echo "Updated gdevelop to $LATEST_VER"