mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-22 22:33:46 +03:00
release: add nixos-*
version branch
Best practice for flakes containing NixOS modules. `push-release` now pushes to an extra branch named `nixos-<version>`, alongside branch `release`. This allows users to track a specific NixOS release, so that their config doesn't break when nix-bitcoin switches to a new NixOS release.
This commit is contained in:
parent
dd532d4738
commit
6510f269f6
@ -2,6 +2,8 @@
|
|||||||
description = "A basic nix-bitcoin node";
|
description = "A basic nix-bitcoin node";
|
||||||
|
|
||||||
inputs.nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release";
|
inputs.nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release";
|
||||||
|
# You can also use a version branch to track a specific NixOS release
|
||||||
|
# inputs.nix-bitcoin.url = "github:fort-nix/nix-bitcoin/nixos-23.05";
|
||||||
|
|
||||||
outputs = { self, nix-bitcoin }: {
|
outputs = { self, nix-bitcoin }: {
|
||||||
|
|
||||||
|
@ -53,6 +53,13 @@ if [[ ! $DRY_RUN ]]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
nixosVersion=$(sed -nE 's|.*system.stateVersion = "(.*?)".*|\1|p' ../examples/configuration.nix)
|
||||||
|
if [[ ! $nixosVersion ]]; then
|
||||||
|
echo "Error fetching NixOS version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
nixosVersionBranch=nixos-$nixosVersion
|
||||||
|
|
||||||
TMPDIR=$(mktemp -d)
|
TMPDIR=$(mktemp -d)
|
||||||
if [[ ! $DRY_RUN ]]; then trap 'rm -rf $TMPDIR' EXIT; fi
|
if [[ ! $DRY_RUN ]]; then trap 'rm -rf $TMPDIR' EXIT; fi
|
||||||
ARCHIVE_NAME=nix-bitcoin-$releaseVersion.tar.gz
|
ARCHIVE_NAME=nix-bitcoin-$releaseVersion.tar.gz
|
||||||
@ -74,9 +81,13 @@ gpg -o nar-hash.txt.asc -a --detach-sig nar-hash.txt
|
|||||||
|
|
||||||
if [[ $DRY_RUN ]]; then
|
if [[ $DRY_RUN ]]; then
|
||||||
echo "Created v$releaseVersion in $TMPDIR"
|
echo "Created v$releaseVersion in $TMPDIR"
|
||||||
|
echo "NixOS version branch: $nixosVersionBranch"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
|
||||||
|
# Create release
|
||||||
|
|
||||||
POST_DATA="{ \"tag_name\": \"v$releaseVersion\", \"name\": \"nix-bitcoin-$releaseVersion\", \"body\": \"nix-bitcoin-$releaseVersion\", \"target_comitish\": \"$BRANCH\" }"
|
POST_DATA="{ \"tag_name\": \"v$releaseVersion\", \"name\": \"nix-bitcoin-$releaseVersion\", \"body\": \"nix-bitcoin-$releaseVersion\", \"target_comitish\": \"$BRANCH\" }"
|
||||||
RESPONSE=$(curl -fsS -H "Authorization: token $OAUTH_TOKEN" -d "$POST_DATA" https://api.github.com/repos/$REPO/releases)
|
RESPONSE=$(curl -fsS -H "Authorization: token $OAUTH_TOKEN" -d "$POST_DATA" https://api.github.com/repos/$REPO/releases)
|
||||||
ID=$(echo "$RESPONSE" | jq -r '.id')
|
ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||||
@ -101,7 +112,8 @@ post_asset "$SHA256SUMS.asc"
|
|||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
if [[ ! $DRY_RUN ]]; then
|
if [[ ! $DRY_RUN ]]; then
|
||||||
git push "$GIT_REMOTE" "${BRANCH}:release"
|
git push "$GIT_REMOTE" "$BRANCH:release"
|
||||||
|
git push "$GIT_REMOTE" "$BRANCH:$nixosVersionBranch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Successfully created" "$(echo "$POST_DATA" | jq -r .tag_name)"
|
echo "Successfully created" "$(echo "$POST_DATA" | jq -r .tag_name)"
|
||||||
|
Loading…
Reference in New Issue
Block a user