mirror of
https://code.forgejo.org/actions/forgejo-release
synced 2026-04-10 20:04:16 +00:00
feat(ci): Allow uploading single files
This commit is contained in:
parent
e7b60f9ae8
commit
562c553e31
4 changed files with 37 additions and 1 deletions
|
|
@ -91,10 +91,17 @@ upload_release() {
|
|||
fi
|
||||
if [ "$SKIP_ASSETS" == 'false' ]; then
|
||||
release_id=$(jq --raw-output .id <"$TMP_DIR"/release.json)
|
||||
for file in "$RELEASE_DIR"/*; do
|
||||
for file in "$RELEASE_DIR"/* "$RELEASE_FILES"; do
|
||||
# https://dev.to/pkutaj/how-to-use-jq-for-uri-encoding-2o5
|
||||
# https://unix.stackexchange.com/questions/94295/shellcheck-is-advising-not-to-use-basename-why/94307#94307
|
||||
# url encode some chars
|
||||
if [ ! "$file" ]; then
|
||||
continue
|
||||
fi
|
||||
if [[ ! -e "$file" ]]; then
|
||||
echo "$file: No such file or directory"
|
||||
exit 1
|
||||
fi
|
||||
asset_name="$(echo -n "${file##*/}" | jq -sRr @uri)"
|
||||
if ! api POST "repos/$REPO/releases/$release_id/assets?name=$asset_name" -H "Content-Type: multipart/form-data" -F "attachment=@$file" >"$TMP_DIR/release-$asset_name.json"; then
|
||||
if ${VERBOSE:-false}; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue