-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: phanirithvij <[email protected]> Co-authored-by: Sandro <[email protected]> Co-authored-by: Franz Pletz <[email protected]>
- Loading branch information
1 parent
6f525d9
commit 42e323c
Showing
2 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p bash nix-update curl coreutils jq common-updater-scripts nix-prefetch | ||
|
||
# adapted from pkgs/by-name/ya/yazi-unwrapped/update.sh | ||
|
||
set -eou pipefail | ||
|
||
NIXPKGS_DIR="$PWD" | ||
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
||
# Get latest release | ||
VIDDY_RELEASE=$( | ||
curl --silent ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \ | ||
https://api.github.com/repos/sachaos/viddy/releases/latest | ||
) | ||
|
||
# Get release information | ||
latestBuildDate=$(echo "$VIDDY_RELEASE" | jq -r ".published_at") | ||
latestVersion=$(echo "$VIDDY_RELEASE" | jq -r ".tag_name") | ||
|
||
latestBuildDate="${latestBuildDate%T*}" # remove the timestamp and get the date | ||
latestVersion="${latestVersion:1}" # remove first char 'v' | ||
|
||
oldVersion=$(nix eval --raw -f "$NIXPKGS_DIR" viddy.version) | ||
|
||
if [[ "$oldVersion" == "$latestVersion" ]]; then | ||
echo "viddy is up-to-date: ${oldVersion}" | ||
exit 0 | ||
fi | ||
|
||
echo "Updating viddy" | ||
|
||
# Version | ||
update-source-version viddy "${latestVersion}" | ||
|
||
pushd "$SCRIPT_DIR" | ||
# Build date | ||
sed -i 's#env.VERGEN_BUILD_DATE = "[^"]*"#env.VERGEN_BUILD_DATE = "'"${latestBuildDate}"'"#' default.nix | ||
|
||
# Hashes | ||
# https://github.com/msteen/nix-prefetch/issues/51 | ||
cargoHash=$(nix-prefetch --option extra-experimental-features flakes "{ sha256 }: (import $NIXPKGS_DIR {}).viddy.cargoDeps.overrideAttrs (_: { outputHash = sha256; })") | ||
sed -i -E 's#\bcargoHash = ".*?"#cargoHash = "'"$cargoHash"'"#' default.nix | ||
popd |