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")
10 if [[ $# -gt 1 ||
$1 == -* ]]; then
11 echo "Regenerates packaging data for the woodpecker packages."
12 echo "Usage: $0 [git release tag]"
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')"
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