From 8c5bcbb7d39f88a91c4c2ecc575b8f09f06339d1 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 2 Oct 2025 09:41:35 -1000 Subject: [PATCH] ;tools:just: release script updates --- Justfile | 164 +++++++++++++++++++++++++---------------------- doc/RELEASING.md | 16 ++--- 2 files changed, 95 insertions(+), 85 deletions(-) diff --git a/Justfile b/Justfile index 6601a0f2d..cd7a03e25 100644 --- a/Justfile +++ b/Justfile @@ -958,6 +958,8 @@ bin-short: # ** Releasing ------------------------------------------------------------ RELEASING: +# These are roughly in the order they should be done during release. + # Create or switch to this release branch, and set the version string in various places. relbranch VER: #!/usr/bin/env bash @@ -988,7 +990,11 @@ relbranch VER: just _on-release-branch tools/relnotes.hs -# Make git tags for a full release today, but don't push them. Run on release branch. +# Upload all packages to hackage (run from release branch). +@hackageupload: + tools/hackageupload $PACKAGES + +# Make git tags for a full release today, but don't push them yet. Run on release branch. reltags: #!/usr/bin/env bash set -euo pipefail @@ -999,27 +1005,24 @@ reltags: git tag --force --sign `cat .version` -m "Release `cat .version`" echo "Release has been tagged!" -# Push the current branch to github binaries branch, generating release binaries. -@relbin: +# Push the current HEAD to github binaries branch, generating platform binaries. +@ghbin: # assumes the github remote is named "origin" git push -f origin HEAD:binaries -# Get the id of the latest run of the named workflow. -@_ghrun-id WORKFLOW: - gh run list --workflow {{ WORKFLOW }} --json databaseId --jq '.[0].databaseId' +# Browse the latest run of the platform binaries workflows. +@ghbin-open: + just ghrun-open binaries-linux-x64 + just ghrun-open binaries-mac-arm64 + just ghrun-open binaries-mac-x64 + just ghrun-open binaries-windows-x64 -# Browse the latest run of the named workflow. -@ghrun WORKFLOW: - gh run view --web $(just _ghrun-id {{ WORKFLOW }}) +# XXX +# Release binaries are downloaded to local machine, repacked, and uploaded to GH release. +# Nightly binaries are copied from their last runs by a workflow on GH. +# Why the difference, is special repacking needed, for release only ? -# Browse the latest run of the main binary workflows. -@ghbin: - just ghrun binaries-linux-x64 - just ghrun binaries-mac-arm64 - just ghrun binaries-mac-x64 - just ghrun binaries-windows-x64 - -# Download any new binaries from the latest runs of the main binary github workflows, and recompress them. +# Download new binaries from the latest runs of the platform binaries workflows, and recompress them. ghbin-download: mkdir -p tmp cd tmp; rm -rf hledger-*64 @@ -1032,16 +1035,16 @@ ghbin-download: cd tmp; rm -rf hledger-*64 # Browse the latest github release. -@ghrel: +@ghrel-open: gh release view -w -# Upload release notes to the configured github release. (Might also create/publish the release ?) +# Upload release notes to the configured github release. @ghrel-notes: just _on-release-branch doc/ghrelnotes `cat .version` | gh release edit `cat .version` -F- -# Upload the downloaded binaries to the specified github release. Run after ghbin-download. -ghrel-bin VER: +# After ghbin-download: upload the downloaded binaries to the specified github release. +ghrel-bin-upload VER: @read -p "Warning! uploading binaries to release {{ VER }}, are you sure ? Enter to proceed: " gh release upload --clobber {{ VER }} tmp/hledger-linux-x64.tar.gz gh release upload --clobber {{ VER }} tmp/hledger-mac-arm64.tar.gz @@ -1052,43 +1055,12 @@ ghrel-bin VER: # gh release upload {{ VER }} tmp/hledger-mac-x64/hledger-mac-x64.tar.gz # gh release upload {{ VER }} tmp/hledger-windows-x64/hledger-windows-x64.tar.gz -# Upload all packages to hackage (run from release branch). -@hackageupload: - tools/hackageupload $PACKAGES - # Push the 5 release tags for the specified release version. reltags-push VER: git push origin {{ VER }} hledger-{{ VER }} hledger-lib-{{ VER }} hledger-ui-{{ VER }} hledger-web-{{ VER }} -# Push master to github, move the nightly tag there, and start building new nightly binaries. -nightly-push: - #!/usr/bin/env bash - set -euo pipefail - just push - git tag -f nightly master - git push -f origin nightly - git push -f origin master:binaries - echo "Now wait; when nightly binaries have built successfully, run just nightly-bin" - -# Copy the latest-built nightly binaries to the Nightly prerelease. Wait for nightly-push's builds to complete first. -@nightly-bin: - gh workflow run nightly - -# Push the prerelease notes to the github nightly prerelease. -@nightly-notes: - gh release edit nightly -F doc/nightlynotes.md - -# Browse the github nightly prerelease. -@nightly-open: - gh release view -w nightly - -# Point the nightly tag at the latest release, locally and on github. Run after a release. -@nightly-tag: - git tag -f nightly $(just relver) - git push -f origin nightly - -# Tag the start of a new dev cycle ("OLDVER.99"), locally and on github. Also update the dev versions/help/manuals. Run on master after a major release. -devtag: +# After major release: in master, tag the start of a new dev cycle ("OLDVER.99") and push the tag. And update the versions/help/manuals there. +devtag-push: #!/usr/bin/env bash set -euo pipefail RELVER=$(just relver) @@ -1106,6 +1078,36 @@ devtag: ./Shake manuals -c echo "Consider also: with $RELVER installed, ./Shake cmddocs -c" +# XXX There's a tag and a github prerelease, both named nightly, creating confusion. + +# After release: point the nightly tag at the release and push the tag. +@nightlytag-push: + git tag -f nightly $(just relver) + git push -f origin nightly + +# XXX Ideally we'd like to adjust and push the nightly tag only after a successful build and push of new binaries. +# Between releases: push master to github, then point the nightly tag there, push the tag, and start building new platform binaries. (Until builds succeed, the tag will be wrong.) +master-nightlyrel-push: + #!/usr/bin/env bash + set -euo pipefail + just push + git tag -f nightly master + git push -f origin nightly + git push -f origin master:binaries + echo "When binaries have built successfully, run just nightlyrel-bin-copy" + +# Browse the github nightly prerelease. +@nightlyrel-open: + gh release view -w nightly + +# Push the nightly prerelease notes to the github nightly prerelease. +@nightlyrel-notes: + gh release edit nightly -F doc/nightlynotes.md + +# After building platform binaries (ghbin), copy them to the github nightly prerelease. +@nightlyrel-bin-copy: + gh workflow run nightly + # ** Installing ------------------------------------------------------------ INSTALLING: @@ -1646,29 +1648,6 @@ bloglog: # ** Misc ------------------------------------------------------------ MISC: -# run tests locally, push master to github ci, wait for tests to pass there, refreshing every INTERVAL (default:10s), then push to github master. -@push *INTERVAL: - just functest --hide && tools/push {{ INTERVAL }} - -# run some tests to validate the development environment -# check-setup: -# run some tests to validate the development environment\ -# ) -# @echo sanity-checking developer environment: -# @({{ SHELLTEST }} checks \ -# && echo $@ PASSED) || echo $@ FAILED - -# sym-link some directories required by hledger-web dev builds -symlink-web-dirs: - echo "#ln -sf hledger-web/config # disabled, causes makeinfo warnings" - ln -sf hledger-web/messages - ln -sf hledger-web/static - ln -sf hledger-web/templates - -# symlink tools/commitlint as .git/hooks/commit-msg -installcommithook: - ln -s ../../tools/commitlint .git/hooks/commit-msg - # ensure the Shake script is compiled Shake: # Shake.hs ./Shake.hs @@ -1693,6 +1672,37 @@ TAGFILES := WEBTEMPLATEFILES + DOCSOURCEFILES + TESTFILES + HPACKFILES + CABALFI @etags-clean: rm -f TAGS +# run some tests to validate the development environment +# check-setup: +# run some tests to validate the development environment\ +# ) +# @echo sanity-checking developer environment: +# @({{ SHELLTEST }} checks \ +# && echo $@ PASSED) || echo $@ FAILED + +# sym-link some directories required by hledger-web dev builds +symlink-web-dirs: + echo "#ln -sf hledger-web/config # disabled, causes makeinfo warnings" + ln -sf hledger-web/messages + ln -sf hledger-web/static + ln -sf hledger-web/templates + +# symlink tools/commitlint as .git/hooks/commit-msg +installcommithook: + ln -s ../../tools/commitlint .git/hooks/commit-msg + +# run tests locally, push master to github ci, wait for tests to pass there, refreshing every INTERVAL (default:10s), then push to github master. +@push *INTERVAL: + just functest --hide && tools/push {{ INTERVAL }} + +# Get the id of the latest run of the named workflow. +@_ghrun-id WORKFLOW: + gh run list --workflow {{ WORKFLOW }} --json databaseId --jq '.[0].databaseId' + +# Browse the latest run of the named workflow. +@ghrun-open WORKFLOW: + gh run view --web $(just _ghrun-id {{ WORKFLOW }}) + # stackclean: \ # $(call def-help-hide,stackclean, remove .stack-work/ dirs ) # $(STACK) purge diff --git a/doc/RELEASING.md b/doc/RELEASING.md index f1292cdd4..79a428f0e 100644 --- a/doc/RELEASING.md +++ b/doc/RELEASING.md @@ -74,7 +74,7 @@ It should be improved each time it is used. - desired improvements landed and stabilised - building and passing tests with current ghcs, deps, and stackage snapshots - building and passing tests on all platforms / with all ghc versions - `just relbin` (or push to github `binaries[-*]` branch) + `just ghbin` (or push to github `binaries[-*]` branch) `just oldest` (or push to github `oldest` branch) - **2. product docs and metadata** @@ -109,7 +109,7 @@ It should be improved each time it is used. - **3. release docs and artifacts** - draft binaries building started - `just relbin` + `just ghbin` - hledger.org html manuals x 3 (site/src/MAJORVER/\*.md) (major release only) `just site-manuals-snapshot MAJORVER` to create/update update `site/Makefile`, `site/js/site.js`, `site/hledger.org.caddy` @@ -125,7 +125,7 @@ It should be improved each time it is used. - release tags `just reltags` - release binaries built from tag - `just relbin`, + `just ghbin`, wait for all to succeed - Install page (site/src/install.md) --version examples match release binaries @@ -153,15 +153,15 @@ It should be improved each time it is used. - github draft release with release binaries attached *(XXX safari may not show new tag, may need brave)* `just ghrel-notes` (in release branch) - `just ghruns-download` - `just ghrel-upload VER` + `just ghbin-download` + `just ghrel-bin-upload VER` - github release published review, publish - github nightly release updated in master, update changes link in doc/ghnightlynotes.md - `just ghnightly-notes` - `just nightly-tag` + `just nightlyrel-notes` + `just nightlytag-push` - install instructions tested and working - stack - cabal @@ -177,7 +177,7 @@ It should be improved each time it is used. - **5. cleanup and support** - review/polish/sync changelogs & relnotes - new version, man dates, dev tag in master (major version only) - `j devtag` + `j devtag-push` - RELEASING.md checklist/notes updated - monitor/support/handle issues: [issue tracker](https://github.com/simonmichael/hledger/issues?q=is%3Aopen+is%3Aissue), matrix, irc, mail list, forum, reddit