biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / continuous-integration / woodpecker / update.sh
blob4ee52f9aded28baf2d6b9402d17f4da5691c2de8
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p nix wget jq nix-prefetch
4 # shellcheck shell=bash
6 if [ -n "$GITHUB_TOKEN" ]; then
7 TOKEN_ARGS=(--header "Authorization: token $GITHUB_TOKEN")
8 fi
10 if [[ $# -gt 1 || $1 == -* ]]; then
11 echo "Regenerates packaging data for the woodpecker packages."
12 echo "Usage: $0 [git release tag]"
13 exit 1
16 set -x
18 cd "$(dirname "$0")"
19 version="$1"
21 set -euo pipefail
23 if [ -z "$version" ]; then
24 version="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/woodpecker-ci/woodpecker/releases?per_page=1" | jq -r '.[0].tag_name')"
27 # strip leading "v"
28 version="${version#v}"
29 sed -i -E -e "s#version = \".*\"#version = \"$version\"#" common.nix
31 # Woodpecker repository
32 src_hash=$(nix-prefetch-url --type sha256 --unpack "https://github.com/woodpecker-ci/woodpecker/releases/download/v$version/woodpecker-src.tar.gz")
33 src_hash=$(nix hash to-sri --type sha256 "$src_hash")
34 sed -i -E -e "s#srcHash = \".*\"#srcHash = \"$src_hash\"#" common.nix