mirror of
https://code.forgejo.org/actions/forgejo-release.git
synced 2024-12-22 10:45:27 +00:00
Merge pull request 'feat: enable release-notes-assistant' (#28) from natct/forgejo-release:use_rna into main
Reviewed-on: https://code.forgejo.org/actions/forgejo-release/pulls/28 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
commit
4f1c5dce43
|
@ -6,11 +6,11 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- id: forgejo
|
- id: forgejo
|
||||||
uses: https://code.forgejo.org/actions/setup-forgejo@v1
|
uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.2
|
||||||
with:
|
with:
|
||||||
user: testuser
|
user: testuser
|
||||||
password: admin1234
|
password: admin1234
|
||||||
image-version: 1.20
|
image-version: 9
|
||||||
|
|
||||||
- name: push self
|
- name: push self
|
||||||
run: |
|
run: |
|
||||||
|
@ -33,6 +33,9 @@ jobs:
|
||||||
- !exclamation_mark'
|
- !exclamation_mark'
|
||||||
test "$EXPECTED" = "$(jq -r .body < /tmp/release.json)"
|
test "$EXPECTED" = "$(jq -r .body < /tmp/release.json)"
|
||||||
|
|
||||||
|
curl --fail -sS $FORGEJO/api/v1/repos/testuser/upload-download/releases/tags/v1.0 > /tmp/v1.json
|
||||||
|
cat /tmp/v1.json | jq -r .body | grep '<!--start release-notes-assistant-->'
|
||||||
|
|
||||||
- name: testdata/upload-download-private
|
- name: testdata/upload-download-private
|
||||||
run: |
|
run: |
|
||||||
export LOOP_DELAY=30
|
export LOOP_DELAY=30
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 }}"
|
||||||
|
|
|
@ -52,15 +52,16 @@ upload_release() {
|
||||||
ensure_tag
|
ensure_tag
|
||||||
anchor=$(echo $TAG | sed -e 's/^v//' -e 's/[^a-zA-Z0-9]/-/g')
|
anchor=$(echo $TAG | sed -e 's/^v//' -e 's/[^a-zA-Z0-9]/-/g')
|
||||||
if ! $BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title "$TITLE" --draft ${releasetype} >& $TMP_DIR/tea.log ; then
|
if ! $BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title "$TITLE" --draft ${releasetype} >& $TMP_DIR/tea.log ; then
|
||||||
if grep --quiet 'Unknown API Error: 500' $TMP_DIR/tea.log && grep --quiet services/release/release.go:194 $TMP_DIR/tea.log ; then
|
if grep --quiet 'Unknown API Error: 500' $TMP_DIR/tea.log && grep --quiet services/release/release.go:194 $TMP_DIR/tea.log ; then
|
||||||
echo "workaround v1.20 race condition https://codeberg.org/forgejo/forgejo/issues/1370"
|
echo "workaround v1.20 race condition https://codeberg.org/forgejo/forgejo/issues/1370"
|
||||||
sleep 10
|
sleep 10
|
||||||
$BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title "$TITLE" --draft ${releasetype}
|
$BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title "$TITLE" --draft ${releasetype}
|
||||||
else
|
else
|
||||||
cat $TMP_DIR/tea.log
|
cat $TMP_DIR/tea.log
|
||||||
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
|
||||||
|
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
tag: v1.0
|
tag: v1.0
|
||||||
token: FORGEJO_TOKEN
|
token: FORGEJO_TOKEN
|
||||||
release-dir: upload-dir
|
release-dir: upload-dir
|
||||||
release-notes: "RELEASE NOTES"
|
release-notes-assistant: true
|
||||||
override: true
|
override: true
|
||||||
verbose: true
|
verbose: true
|
||||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||||
|
|
Loading…
Reference in a new issue