mirror of
https://code.forgejo.org/actions/forgejo-release.git
synced 2024-11-24 10:30:55 -05:00
97 lines
2.9 KiB
YAML
97 lines
2.9 KiB
YAML
# SPDX-License-Identifier: MIT
|
|
name: 'Forgejo release download and upload'
|
|
author: 'Forgejo authors'
|
|
description: |
|
|
Upload or download the assets of a release to a Forgejo instance.
|
|
inputs:
|
|
url:
|
|
description: 'URL of the Forgejo instance'
|
|
repo:
|
|
description: 'owner/project relative to the URL'
|
|
tag:
|
|
description: 'Tag of the release'
|
|
sha:
|
|
description: 'SHA of the release'
|
|
token:
|
|
description: 'Forgejo application token'
|
|
required: true
|
|
release-dir:
|
|
description: 'Directory in whichs release assets are uploaded or downloaded'
|
|
required: true
|
|
release-notes:
|
|
description: 'Release notes'
|
|
direction:
|
|
description: 'Can either be download or upload'
|
|
required: true
|
|
gpg-private-key:
|
|
description: 'GPG Private Key to sign the release artifacts'
|
|
gpg-passphrase:
|
|
description: 'Passphrase of the GPG Private Key'
|
|
download-retry:
|
|
description: 'Number of times to retry if the release is not ready (default 1)'
|
|
verbose:
|
|
description: 'Increase the verbosity level'
|
|
default: 'false'
|
|
override:
|
|
description: 'Override an existing release by the same {tag}'
|
|
default: 'false'
|
|
prerelease:
|
|
description: 'Mark Release as Pre-Release'
|
|
default: 'false'
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
|
|
shell: bash
|
|
- run: |
|
|
export FORGEJO="${{ inputs.url }}"
|
|
if test -z "$FORGEJO"; then
|
|
export FORGEJO="${{ env.GITHUB_SERVER_URL }}"
|
|
fi
|
|
# A trailing / will mean http://forgejo//api/v1 is used
|
|
# and it always 401 as of v1.19, because of the double slash
|
|
FORGEJO=${FORGEJO%%/}
|
|
|
|
export REPO="${{ inputs.repo }}"
|
|
if test -z "$REPO"; then
|
|
export REPO="${{ github.repository }}"
|
|
fi
|
|
|
|
export TAG="${{ inputs.tag }}"
|
|
if test -z "$TAG"; then
|
|
export TAG="${{ github.ref_name }}"
|
|
# until https://code.forgejo.org/forgejo/runner/issues/9 is fixed
|
|
# trim refs/tags/
|
|
TAG=${TAG##refs/tags/}
|
|
fi
|
|
|
|
export PRERELEASE="${{ inputs.prerelease }}"
|
|
|
|
export TOKEN="${{ inputs.token }}"
|
|
|
|
export RELEASE_DIR="${{ inputs.release-dir }}"
|
|
|
|
export RELEASENOTES="${{ inputs.release-notes }}"
|
|
|
|
export SHA="${{ inputs.sha }}"
|
|
if test -z "$SHA"; then
|
|
export SHA="${{ github.sha }}"
|
|
fi
|
|
|
|
export OVERRIDE="${{ inputs.override }}"
|
|
|
|
export VERBOSE="${{ inputs.verbose }}"
|
|
|
|
export RETRY="${{ inputs.download-retry }}"
|
|
|
|
export TMP_DIR=$(mktemp -d)
|
|
trap "rm -fr $TMP_DIR" EXIT
|
|
|
|
echo -n "${{ inputs.gpg-private-key }}" > $TMP_DIR/gpg-private-key
|
|
export GPG_PRIVATE_KEY=$TMP_DIR/gpg-private-key
|
|
echo -n "${{ inputs.gpg-passphrase }}" > $TMP_DIR/gpg-passphrase
|
|
export GPG_PASSPHRASE="$TMP_DIR/gpg-passphrase"
|
|
|
|
forgejo-release.sh ${{ inputs.direction }}
|
|
shell: bash
|