mirror of
https://code.forgejo.org/actions/forgejo-release.git
synced 2024-12-21 15:15:49 +02:00
feat: add an option to hide archive link
This commit is contained in:
parent
e31d55ec37
commit
5069284121
5 changed files with 21 additions and 8 deletions
|
@ -24,18 +24,22 @@ jobs:
|
|||
|
||||
set -ex
|
||||
export FORGEJO="${{ steps.forgejo.outputs.url }}"
|
||||
curl --fail -sS $FORGEJO/api/v1/repos/testuser/upload-download/releases/tags/v2.0 > /tmp/release.json
|
||||
curl --fail -sS $FORGEJO/api/v1/repos/testuser/upload-download/releases/tags/v2.0 > /tmp/v2.json
|
||||
EXPECTED='No shell expansion should on these notes:
|
||||
- $(some_command)
|
||||
- `other_commend`
|
||||
- "double quoted" and '\''single quoted'\'' strings
|
||||
- \backslash escape
|
||||
- !exclamation_mark'
|
||||
test "$EXPECTED" = "$(jq -r .body < /tmp/release.json)"
|
||||
test "$EXPECTED" = "$(jq -r .body < /tmp/v2.json)"
|
||||
|
||||
test $(cat /tmp/v2.json | jq -r .hide_archive_links) = false
|
||||
|
||||
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-->'
|
||||
|
||||
test $(cat /tmp/v1.json | jq -r .hide_archive_links) = true
|
||||
|
||||
- name: testdata/upload-download-private
|
||||
run: |
|
||||
export LOOP_DELAY=30
|
||||
|
|
|
@ -27,6 +27,7 @@ Upload or download the assets of a release to a Forgejo instance.
|
|||
| `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` |
|
||||
| `release-notes-assistant` | <p>Generate release notes with Release Notes Assistant</p> | `false` | `false` |
|
||||
| `hide-archive-link` | <p>Hide the archive links</p> | `false` | `false` |
|
||||
<!-- action-docs-inputs source="action.yml" -->
|
||||
|
||||
## Examples
|
||||
|
|
15
action.yml
15
action.yml
|
@ -33,19 +33,22 @@ inputs:
|
|||
description: 'Number of times to retry if the release is not ready (default 1)'
|
||||
download-latest:
|
||||
description: 'Download the latest release'
|
||||
default: 'false'
|
||||
default: false
|
||||
verbose:
|
||||
description: 'Increase the verbosity level'
|
||||
default: 'false'
|
||||
default: false
|
||||
override:
|
||||
description: 'Override an existing release by the same `{tag}`'
|
||||
default: 'false'
|
||||
default: false
|
||||
prerelease:
|
||||
description: 'Mark Release as Pre-Release'
|
||||
default: 'false'
|
||||
default: false
|
||||
release-notes-assistant:
|
||||
description: 'Generate release notes with Release Notes Assistant'
|
||||
default: 'false'
|
||||
default: false
|
||||
hide-archive-link:
|
||||
description: 'Hide the archive links'
|
||||
default: false
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
@ -84,6 +87,8 @@ runs:
|
|||
|
||||
export RELEASE_NOTES_ASSISTANT="${{ inputs.release-notes-assistant }}"
|
||||
|
||||
export HIDE_ARCHIVE_LINK="${{ inputs.hide-archive-link }}"
|
||||
|
||||
export TOKEN="${{ inputs.token }}"
|
||||
|
||||
export RELEASE_DIR="${{ inputs.release-dir }}"
|
||||
|
|
|
@ -15,6 +15,7 @@ if ${VERBOSE:-false}; then set -x; fi
|
|||
: ${BIN_DIR:=$TMP_DIR}
|
||||
: ${TEA_VERSION:=0.9.0}
|
||||
: ${OVERRIDE:=false}
|
||||
: ${HIDE_ARCHIVE_LINK:=false}
|
||||
: ${RETRY:=1}
|
||||
: ${DELAY:=10}
|
||||
|
||||
|
@ -69,7 +70,8 @@ release_draft() {
|
|||
local state="$1"
|
||||
|
||||
local id=$(api GET repos/$REPO/releases/tags/$TAG | jq --raw-output .id)
|
||||
api PATCH repos/$REPO/releases/$id --data-raw '{"draft": '$state'}'
|
||||
|
||||
api PATCH repos/$REPO/releases/$id --data-raw '{"draft": '$state', "hide_archive_links": '$HIDE_ARCHIVE_LINK'}'
|
||||
}
|
||||
|
||||
maybe_use_release_note_assistant() {
|
||||
|
|
|
@ -26,6 +26,7 @@ jobs:
|
|||
token: FORGEJO_TOKEN
|
||||
release-dir: upload-dir
|
||||
release-notes-assistant: true
|
||||
hide-archive-link: true
|
||||
override: true
|
||||
verbose: true
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
|
|
Loading…
Reference in a new issue