no zen auto-updates for now
This commit is contained in:
parent
cf78903b70
commit
599a4927ee
3 changed files with 69 additions and 5 deletions
2
.github/workflows/update.yml
vendored
2
.github/workflows/update.yml
vendored
|
|
@ -51,7 +51,6 @@ jobs:
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
git config user.email github-actions@github.com
|
git config user.email github-actions@github.com
|
||||||
nix flake update --accept-flake-config
|
nix flake update --accept-flake-config
|
||||||
./packages/zen-browser-unwrapped/update.sh
|
|
||||||
git diff
|
git diff
|
||||||
if [[ -n $(git status -s) ]]; then
|
if [[ -n $(git status -s) ]]; then
|
||||||
echo "CHANGED=true" >> $GITHUB_OUTPUT
|
echo "CHANGED=true" >> $GITHUB_OUTPUT
|
||||||
|
|
@ -227,7 +226,6 @@ jobs:
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
git config user.email github-actions@github.com
|
git config user.email github-actions@github.com
|
||||||
nix flake update --accept-flake-config
|
nix flake update --accept-flake-config
|
||||||
./packages/zen-browser-unwrapped/update.sh
|
|
||||||
git diff
|
git diff
|
||||||
if [[ -n $(git status -s) ]]; then
|
if [[ -n $(git status -s) ]]; then
|
||||||
echo "CHANGED=true" >> $GITHUB_OUTPUT
|
echo "CHANGED=true" >> $GITHUB_OUTPUT
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
in
|
in
|
||||||
buildStdenv.mkDerivation rec {
|
buildStdenv.mkDerivation rec {
|
||||||
pname = "zen-browser-unwrapped";
|
pname = "zen-browser-unwrapped";
|
||||||
version = "1.0.1-a.10";
|
version = "1.0.1-a.12";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "zen-browser";
|
owner = "zen-browser";
|
||||||
|
|
@ -159,13 +159,13 @@ in
|
||||||
rev = "${version}";
|
rev = "${version}";
|
||||||
leaveDotGit = true;
|
leaveDotGit = true;
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
hash = "sha256-JnohKvY7455qlPpcr38307DEnAWFdJF+liLBnvBSl98=";
|
hash = "sha256-O5S468G+2fF11mnjR8lMSVBOTRe/X5VxfBLAEVh2mA0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
firefoxVersion = (lib.importJSON "${src}/surfer.json").version.version;
|
firefoxVersion = (lib.importJSON "${src}/surfer.json").version.version;
|
||||||
firefoxSrc = fetchurl {
|
firefoxSrc = fetchurl {
|
||||||
url = "mirror://mozilla/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.xz";
|
url = "mirror://mozilla/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.xz";
|
||||||
hash = "sha256-en3z+Xc3RT76okPKnbr5XQ8PgzxdyK+stXBO4W7wYNA=";
|
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
SURFER_COMPAT = generic;
|
SURFER_COMPAT = generic;
|
||||||
|
|
|
||||||
66
packages/zen-browser-unwrapped/update.sh
Normal file → Executable file
66
packages/zen-browser-unwrapped/update.sh
Normal file → Executable file
|
|
@ -0,0 +1,66 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-git nix-prefetch-github
|
||||||
|
|
||||||
|
# Define the package file
|
||||||
|
PACKAGE_FILE="default.nix"
|
||||||
|
|
||||||
|
# Function to get the latest version of zen-browser/desktop
|
||||||
|
get_latest_version() {
|
||||||
|
curl --silent "https://api.github.com/repos/zen-browser/desktop/releases" |
|
||||||
|
jq -r '[.[] | select(.prerelease==false)][0].tag_name'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the latest version
|
||||||
|
latest_version=$(get_latest_version)
|
||||||
|
|
||||||
|
if [ -z "$latest_version" ] || [ "$latest_version" == "null" ]; then
|
||||||
|
echo "Failed to get the latest version."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Latest version: $latest_version"
|
||||||
|
|
||||||
|
# Update the 'version' variable in the Nix expression
|
||||||
|
sed -i "/pname = \"zen-browser-unwrapped\";/,/version = \".*\";/s/version = \".*\";/version = \"$latest_version\";/" "$PACKAGE_FILE"
|
||||||
|
|
||||||
|
# Fetch the new 'src' hash
|
||||||
|
echo "Fetching new source hash..."
|
||||||
|
src_info=$(nix-prefetch-github zen-browser desktop --rev "$latest_version" --fetch-submodules)
|
||||||
|
src_hash=$(echo "$src_info" | jq -r .sha256)
|
||||||
|
|
||||||
|
echo "New source hash: $src_hash"
|
||||||
|
|
||||||
|
# Update 'rev' and 'hash' in the 'src' fetchFromGitHub
|
||||||
|
sed -i "/src = fetchFromGitHub {/,/};/{
|
||||||
|
/owner = \"zen-browser\";/,/};/{
|
||||||
|
s/rev = \".*\";/rev = \"$latest_version\";/
|
||||||
|
s/hash = \".*\";/hash = \"$src_hash\";/
|
||||||
|
}
|
||||||
|
}" "$PACKAGE_FILE"
|
||||||
|
|
||||||
|
# Clone the repository to extract 'firefoxVersion'
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
trap 'rm -rf "$tmpdir"' EXIT
|
||||||
|
|
||||||
|
git clone --depth 1 --branch "$latest_version" https://github.com/zen-browser/desktop.git "$tmpdir"
|
||||||
|
|
||||||
|
# Extract 'firefoxVersion' from 'surfer.json'
|
||||||
|
firefoxVersion=$(jq --raw-output '.version.version' "$tmpdir/surfer.json")
|
||||||
|
echo "Firefox version: $firefoxVersion"
|
||||||
|
|
||||||
|
# Update the 'firefoxVersion' in the Nix expression
|
||||||
|
sed -i "s/firefoxVersion = \".*\";/firefoxVersion = \"$firefoxVersion\";/" "$PACKAGE_FILE"
|
||||||
|
|
||||||
|
# Fetch the new 'firefoxSrc' hash
|
||||||
|
firefox_url="mirror://mozilla/firefox/releases/$firefoxVersion/source/firefox-$firefoxVersion.source.tar.xz"
|
||||||
|
echo "Fetching Firefox source hash..."
|
||||||
|
firefox_hash=$(nix-prefetch-url --unpack "$firefox_url")
|
||||||
|
|
||||||
|
echo "Firefox source hash: $firefox_hash"
|
||||||
|
|
||||||
|
# Update the 'firefoxSrc' hash in the Nix expression
|
||||||
|
sed -i "/firefoxSrc = fetchurl {/,/};/{
|
||||||
|
s/hash = \".*\";/hash = \"$firefox_hash\";/
|
||||||
|
}" "$PACKAGE_FILE"
|
||||||
|
|
||||||
|
echo "Update complete!"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue