diff --git a/action.yml b/action.yml index f6725c7..268d42b 100644 --- a/action.yml +++ b/action.yml @@ -22,8 +22,8 @@ inputs: description: 'Forgejo application token' default: '${{ forge.token }}' release-dir: - description: 'Directory in whichs release assets are uploaded or downloaded' - required: true + description: 'Directory in which release assets are uploaded or downloaded' + default: '' release-notes: description: 'Release notes' direction: @@ -53,6 +53,9 @@ inputs: hide-archive-link: description: 'Hide the archive links' default: false + skip-assets: + description: Skip uploading release assets + default: 'false' runs: using: "composite" @@ -113,5 +116,7 @@ runs: echo -n "${{ inputs.gpg-passphrase }}" > $TMP_DIR/gpg-passphrase export GPG_PASSPHRASE="$TMP_DIR/gpg-passphrase" + export SKIP_ASSETS="${{ inputs.skip-assets }}" + forgejo-release.sh ${{ inputs.direction }} shell: bash diff --git a/forgejo-release.sh b/forgejo-release.sh index 83ce24d..22bdbab 100755 --- a/forgejo-release.sh +++ b/forgejo-release.sh @@ -84,9 +84,11 @@ upload_release() { # It is expanded using "${assets[@]}" which preserves the separation of arguments and not split whitespace containing values. # For reference, see https://github.com/koalaman/shellcheck/wiki/SC2086#exceptions local assets=() - for file in "$RELEASE_DIR"/*; do - assets=("${assets[@]}" -a "$file") - done + if ! "$SKIP_ASSETS"; then + for file in "$RELEASE_DIR"/*; do + assets=("${assets[@]}" -a "$file") + done + fi if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then releaseType="--prerelease" echo "Uploading as Pre-Release" diff --git a/testdata/upload-download/.forgejo/workflows/test.yml b/testdata/upload-download/.forgejo/workflows/test.yml index a9c357d..518e019 100644 --- a/testdata/upload-download/.forgejo/workflows/test.yml +++ b/testdata/upload-download/.forgejo/workflows/test.yml @@ -92,5 +92,35 @@ jobs: - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} run: | diff -u upload-dir-v3 download-dir-v3 + + - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} + id: release-upload-v4 + uses: SELF@vTest + with: + direction: upload + tag: v4.0 + token: FORGEJO_TEST_TOKEN + skip-assets: true + verbose: true + + - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} + id: release-download-v4 + uses: SELF@vTest + with: + direction: download + tag: v4.0 + token: FORGEJO_TEST_TOKEN + release-dir: download-dir-v4 + - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} + run: | + if [ ! -d download-dir-v4 ]; then + echo "Missing download dir" + exit 1 + fi + if [ ! -z "$( ls -A download-dir-v4 )" ]; then + echo "Unexpected download files: $( ls -A download-dir-v4 )" + exit 1 + fi + - if: failure() run: docker logs forgejo