0
1
Fork 1
mirror of https://code.forgejo.org/actions/forgejo-release synced 2024-09-19 10:45:49 +02:00
forgejo-release/action.yml

70 lines
2.1 KiB
YAML

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'
doer:
description: 'Forgejo user authoring the upload'
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
verbose:
description: 'Increase the verbosity level'
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 }}"
fi
export DOER="${{ inputs.doer }}"
export TOKEN="${{ inputs.token }}"
if test -z "$TOKEN"; then
export TOKEN="${{ github.token }}"
fi
if test -z "$TOKEN"; then
export TOKEN="${{ secrets.GITHUB_TOKEN }}"
fi
test "$TOKEN"
export RELEASE_DIR="${{ inputs.release-dir }}"
export RELEASENOTES="${{ inputs.release-notes }}"
export VERBOSE="${{ inputs.verbose }}"
export SHA="${{ inputs.sha }}"
if test -z "$SHA"; then
export SHA="${{ github.sha }}"
fi
forgejo-release.sh ${{ inputs.direction }}
shell: bash