diff --git a/.forgejo/workflows/integration.yml b/.forgejo/workflows/integration.yml index fa03d75..3e9bb66 100644 --- a/.forgejo/workflows/integration.yml +++ b/.forgejo/workflows/integration.yml @@ -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 '' + test $(cat /tmp/v1.json | jq -r .hide_archive_links) = true + - name: testdata/upload-download-private run: | export LOOP_DELAY=30 diff --git a/README.md b/README.md index eb2cd79..eb93cf2 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Upload or download the assets of a release to a Forgejo instance. | `override` |
Override an existing release by the same {tag}
Mark Release as Pre-Release
| `false` | `false` | | `release-notes-assistant` |Generate release notes with Release Notes Assistant
| `false` | `false` | +| `hide-archive-link` |Hide the archive links
| `false` | `false` | ## Examples diff --git a/action.yml b/action.yml index f903b1c..847c886 100644 --- a/action.yml +++ b/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 }}" diff --git a/forgejo-release.sh b/forgejo-release.sh index 13c9493..3b1e4b1 100755 --- a/forgejo-release.sh +++ b/forgejo-release.sh @@ -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() { diff --git a/testdata/upload-download/.forgejo/workflows/test.yml b/testdata/upload-download/.forgejo/workflows/test.yml index be2a6a8..a88867a 100644 --- a/testdata/upload-download/.forgejo/workflows/test.yml +++ b/testdata/upload-download/.forgejo/workflows/test.yml @@ -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') }}