WIP: update woodpecker
All checks were successful
ci/woodpecker/push/check Pipeline was successful

This commit is contained in:
Bruno BELANYI 2023-07-30 13:56:46 +01:00
parent ef4e5e3ccc
commit 11e4772f4d
6 changed files with 1157 additions and 1093 deletions

View file

@ -16,22 +16,25 @@ fi
set -x
cd "$(dirname "$0")"
rev="$1"
version="$1"
set -euo pipefail
if [ -z "$rev" ]; then
rev="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/woodpecker-ci/woodpecker/commits?per_page=1" | jq -r '.[0].sha')"
if [ -z "$version" ]; then
version="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/woodpecker-ci/woodpecker/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
# strip leading "v"
version="${version#v}"
# Woodpecker repository
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "${rev}" | jq -r .sha256)
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "v${version}" | jq -r .hash)
# Go modules
mod_hash=$(nix-prefetch '{ sha256 }: (callPackage (import ./cli.nix) { }).go-modules.overrideAttrs (_: { modHash = sha256; })')
vendorHash=$(nix-prefetch '{ sha256 }: (callPackage (import ./cli.nix) { }).goModules.overrideAttrs (_: { modHash = sha256; })')
# Front-end dependencies
woodpecker_src="https://raw.githubusercontent.com/woodpecker-ci/woodpecker/$rev"
woodpecker_src="https://raw.githubusercontent.com/woodpecker-ci/woodpecker/v$version"
wget "${TOKEN_ARGS[@]}" "$woodpecker_src/web/package.json" -O woodpecker-package.json
trap 'rm -rf pnpm-lock.yaml' EXIT
@ -41,10 +44,10 @@ yarn_hash=$(prefetch-yarn-deps yarn.lock)
# Use friendlier hashes
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
mod_hash=$(nix hash to-sri --type sha256 "$mod_hash")
vendorHash=$(nix hash to-sri --type sha256 "$vendorHash")
yarn_hash=$(nix hash to-sri --type sha256 "$yarn_hash")
sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" common.nix
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" common.nix
sed -i -E -e "s#srcHash = \".*\"#srcHash = \"$src_hash\"#" common.nix
sed -i -E -e "s#modHash = \".*\"#modHash = \"$mod_hash\"#" common.nix
sed -i -E -e "s#vendorHash = \".*\"#vendorHash = \"$vendorHash\"#" common.nix
sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix