fix: Make release-dir and assets optional

This commit is contained in:
Jan Willhaus 2025-08-31 12:33:08 +02:00
parent 9223b9c0d5
commit fdadfb4c64
2 changed files with 6 additions and 2 deletions

View file

@ -22,8 +22,8 @@ inputs:
description: 'Forgejo application token' description: 'Forgejo application token'
default: '${{ forge.token }}' default: '${{ forge.token }}'
release-dir: release-dir:
description: 'Directory in whichs release assets are uploaded or downloaded' description: 'Directory in which release assets are uploaded or downloaded'
required: true default: dist/release
release-notes: release-notes:
description: 'Release notes' description: 'Release notes'
direction: direction:

View file

@ -84,9 +84,11 @@ upload_release() {
# It is expanded using "${assets[@]}" which preserves the separation of arguments and not split whitespace containing values. # 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 # For reference, see https://github.com/koalaman/shellcheck/wiki/SC2086#exceptions
local assets=() local assets=()
shopt -s nullglob
for file in "$RELEASE_DIR"/*; do for file in "$RELEASE_DIR"/*; do
assets=("${assets[@]}" -a "$file") assets=("${assets[@]}" -a "$file")
done done
shopt -u nullglob
if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then
releaseType="--prerelease" releaseType="--prerelease"
echo "Uploading as Pre-Release" echo "Uploading as Pre-Release"
@ -131,12 +133,14 @@ sign_release() {
passphrase="--passphrase-file $GPG_PASSPHRASE" passphrase="--passphrase-file $GPG_PASSPHRASE"
fi fi
gpg --import --no-tty --pinentry-mode loopback $passphrase "$GPG_PRIVATE_KEY" gpg --import --no-tty --pinentry-mode loopback $passphrase "$GPG_PRIVATE_KEY"
shopt -s nullglob
for asset in "$RELEASE_DIR"/*; do for asset in "$RELEASE_DIR"/*; do
if [[ $asset =~ .sha256$ ]]; then if [[ $asset =~ .sha256$ ]]; then
continue continue
fi fi
gpg --armor --detach-sign --no-tty --pinentry-mode loopback $passphrase <"$asset" >"$asset".asc gpg --armor --detach-sign --no-tty --pinentry-mode loopback $passphrase <"$asset" >"$asset".asc
done done
shopt -u nullglob
} }
maybe_sign_release() { maybe_sign_release() {