diff --git a/overlay/github.nix b/overlay/github.nix index e232c8d..0cf401d 100644 --- a/overlay/github.nix +++ b/overlay/github.nix @@ -13,6 +13,12 @@ # If 'release-tag' is 'autorelease' or 'PRERELEASE' env variable is set to 'true' # created release is marked as 'prerelease'. # + # 'OVERWRITE_RELEASE' env variable is set to 'true' an existing release with 'release-tag' + # will be deleted prior to recreation. + # + # This script expects 'GH_TOKEN' env variable to be set to a GitHub PAT that is capable of + # managing releases in the target repository. + # # Usage examples: # autorelease "$(nix build .#release)" "Automatic release on "$(date +\"%Y%m%d%H%M\")"" # @@ -25,9 +31,10 @@ release_notes="$2"; release_tag="''${3:-auto-release}" - # gh expects 'GH_TOKEN' env variable to be set - # Delete release if it exists - gh release delete "$release_tag" --yes || true + if [[ ''${OVERWRITE_RELEASE:-false} == true ]]; then + # Delete release if it exists + gh release delete "$release_tag" --yes || true + fi typeset -a release_args # Create release