Skip to content

Commit

Permalink
Use scriv for changelog management
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Bahl authored and ctheune committed Oct 30, 2024
1 parent ffd162a commit 213afb5
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: ^secrets/|^appenv$|pkgs/fc/sensusyntax/fixtures/(syntaxerror|empty).json|(nixos/infrastructure/container.nix|tests/testlib.nix|nixos/roles/devhost/vm.nix)
exclude: ^secrets/|^appenv$|pkgs/fc/sensusyntax/fixtures/(syntaxerror|empty).json|(nixos/infrastructure/container.nix|tests/testlib.nix|nixos/roles/devhost/vm.nix)|^changelog.d/new_fragment.md.j2$
repos:
- hooks:
- exclude: "(?x)^(\n secrets/|environments/.*/secret.*|\n .*\\.patch\n)$\n"
Expand Down
Empty file added changelog.d/CHANGELOG.md
Empty file.
17 changes: 17 additions & 0 deletions changelog.d/new_fragment.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
A new scriv changelog fragment.
(Un)comment the section that is right (add/remove the HTML comment wrapper).
-->

<!--
### Impact
- A bullet item for the Impact category.
-->

### NixOS platform

- A bullet item for the NixOS platform category.

6 changes: 6 additions & 0 deletions changelog.d/scriv.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[scriv]
format = md
entry_title_template =
categories = Impact, NixOS platform
output_file = changelog.d/CHANGELOG.md.tmp
skip_fragments = CHANGELOG.*
2 changes: 1 addition & 1 deletion changelog.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

nix develop --impure --command scriv create --edit
nix develop --impure --command scriv create --edit --add
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@

packages = with pkgs; [
jq
scriv
] ++ (with self'.packages; [
fcBranchDiffRelease
fcGetCurrentChannelUrl
Expand Down
23 changes: 23 additions & 0 deletions release/fc-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,38 @@ if ! git remote -v | grep -Eq "^origin\s.*github.com.flyingcircusio/fc-nixos"; t
exit 64
fi

if [[ ! -d ../doc/changelog.d ]] || ! git -C ../doc remote -v | grep -Eq "^origin\s.*github.com.flyingcircusio/doc"; then
echo "$0: please ensure that you have a checkout of flyingcircusio/doc next to this repo"
exit 64
fi
if [[ -e ../doc/changelog.d/"$nixos_version".md ]]; then
echo "$0: the changelog fragment '../doc/changelog.d/$nixos_version.md' already exists"
exit 64
fi

git fetch origin --tags --prune
git checkout "$dev"
git merge --ff-only # expected to fail on unclean/unpushed workdirs

git checkout "$stag"
git merge --ff-only

TEMP_CHANGELOG=changelog.d/CHANGELOG.md.tmp
CHANGELOG=changelog.d/CHANGELOG.md
truncate -s 0 $TEMP_CHANGELOG
scriv collect --add
sed -e "s/^## Impact/## Impact\n### $nixos_version/" \
-e "s/^## NixOS platform/## NixOS $nixos_version platform/" $TEMP_CHANGELOG > ../doc/changelog.d/"$nixos_version".md
echo -e "\n" >> $TEMP_CHANGELOG
cat $CHANGELOG >> $TEMP_CHANGELOG
(echo "# Release $releaseid"; cat $TEMP_CHANGELOG) > $CHANGELOG
rm $TEMP_CHANGELOG
git add $TEMP_CHANGELOG $CHANGELOG
git commit -m "Collect changelog fragments"

git checkout "$prod"
git merge --ff-only

msg="Merge branch '$stag' into $prod for release $releaseid"
git merge -m "$msg" "$stag"

Expand Down

0 comments on commit 213afb5

Please sign in to comment.