feat(ci): use Release Notes Assistant

This commit is contained in:
natct 2024-10-29 16:08:41 +01:00
parent a4252003d2
commit 59d006123b
3 changed files with 25 additions and 8 deletions

View file

@ -26,6 +26,7 @@ Upload or download the assets of a release to a Forgejo instance.
| `verbose` | <p>Increase the verbosity level</p> | `false` | `false` | | `verbose` | <p>Increase the verbosity level</p> | `false` | `false` |
| `override` | <p>Override an existing release by the same <code>{tag}</code></p> | `false` | `false` | | `override` | <p>Override an existing release by the same <code>{tag}</code></p> | `false` | `false` |
| `prerelease` | <p>Mark Release as Pre-Release</p> | `false` | `false` | | `prerelease` | <p>Mark Release as Pre-Release</p> | `false` | `false` |
| `release-notes-assistant` | <p>Generate release notes with Release Notes Assistant</p> | `false` | `false` |
<!-- action-docs-inputs source="action.yml" --> <!-- action-docs-inputs source="action.yml" -->
## Examples ## Examples

View file

@ -43,6 +43,9 @@ inputs:
prerelease: prerelease:
description: 'Mark Release as Pre-Release' description: 'Mark Release as Pre-Release'
default: 'false' default: 'false'
release-notes-assistant:
description: 'Generate release notes with Release Notes Assistant'
default: 'false'
runs: runs:
using: "composite" using: "composite"
@ -57,6 +60,8 @@ runs:
# A trailing / will mean http://forgejo//api/v1 is used # A trailing / will mean http://forgejo//api/v1 is used
# and it always 401 as of v1.19, because of the double slash # and it always 401 as of v1.19, because of the double slash
FORGEJO=${FORGEJO%%/} FORGEJO=${FORGEJO%%/}
export SCHEME=${FORGEJO%://*}
export HOST=${FORGEJO#*://}
export REPO="${{ inputs.repo }}" export REPO="${{ inputs.repo }}"
if test -z "$REPO"; then if test -z "$REPO"; then
@ -77,6 +82,8 @@ runs:
export PRERELEASE="${{ inputs.prerelease }}" export PRERELEASE="${{ inputs.prerelease }}"
export RELEASE_NOTES_ASSISTANT="${{ inputs.release-notes-assistant }}"
export TOKEN="${{ inputs.token }}" export TOKEN="${{ inputs.token }}"
export RELEASE_DIR="${{ inputs.release-dir }}" export RELEASE_DIR="${{ inputs.release-dir }}"

View file

@ -61,6 +61,7 @@ upload_release() {
return 1 return 1
fi fi
fi fi
maybe_use_release_note_assistant
release_draft false release_draft false
} }
@ -71,6 +72,14 @@ release_draft() {
api PATCH repos/$REPO/releases/$id --data-raw '{"draft": '$state'}' api PATCH repos/$REPO/releases/$id --data-raw '{"draft": '$state'}'
} }
maybe_use_release_note_assistant() {
if "$RELEASE_NOTES_ASSISTANT"; then
curl --fail -s -S -o rna https://code.forgejo.org/forgejo/release-notes-assistant/releases/download/v1.2.3/release-notes-assistant
chmod +x ./rna
./rna --storage release --storage-location $TAG --forgejo-url $SCHEME://placeholder:$TOKEN@$HOST --repository $REPO --token $TOKEN release $TAG
fi
}
sign_release() { sign_release() {
local passphrase local passphrase
if test -s "$GPG_PASSPHRASE"; then if test -s "$GPG_PASSPHRASE"; then