2023-03-29 11:16:26 -04:00
|
|
|
name: 'Forgejo release download and upload'
|
2023-03-26 11:41:37 -04:00
|
|
|
author: 'Forgejo authors'
|
|
|
|
description: |
|
2023-03-29 11:16:26 -04:00
|
|
|
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'
|
2023-03-29 13:29:24 -04:00
|
|
|
sha:
|
|
|
|
description: 'SHA of the release'
|
2023-03-29 11:16:26 -04:00
|
|
|
token:
|
|
|
|
description: 'Forgejo application token'
|
|
|
|
required: true
|
|
|
|
release-dir:
|
|
|
|
description: 'Directory in whichs release assets are uploaded or downloaded'
|
|
|
|
required: true
|
2023-03-29 17:59:02 -04:00
|
|
|
release-notes:
|
|
|
|
description: 'Release notes'
|
2023-03-29 11:16:26 -04:00
|
|
|
direction:
|
|
|
|
description: 'Can either be download or upload'
|
|
|
|
required: true
|
|
|
|
verbose:
|
|
|
|
description: 'Increase the verbosity level'
|
|
|
|
default: 'false'
|
|
|
|
|
2023-03-26 11:41:37 -04:00
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
|
|
|
|
shell: bash
|
2023-03-29 11:16:26 -04:00
|
|
|
- run: |
|
|
|
|
export FORGEJO="${{ inputs.url }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
if test -z "$FORGEJO"; then
|
2023-03-30 09:37:51 -04:00
|
|
|
export FORGEJO="${{ env.GITHUB_SERVER_URL }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
fi
|
2023-03-30 09:37:51 -04:00
|
|
|
# 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%%/}
|
2023-03-29 11:16:26 -04:00
|
|
|
export REPO="${{ inputs.repo }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
if test -z "$REPO"; then
|
|
|
|
export REPO="${{ github.repository }}"
|
|
|
|
fi
|
2023-03-29 11:16:26 -04:00
|
|
|
export TAG="${{ inputs.tag }}"
|
2023-03-30 08:18:23 -04:00
|
|
|
if test -z "$TAG"; then
|
|
|
|
export TAG="${{ github.ref_name }}"
|
|
|
|
fi
|
2023-03-29 11:16:26 -04:00
|
|
|
export TOKEN="${{ inputs.token }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
if test -z "$TOKEN"; then
|
2023-03-30 10:28:59 -04:00
|
|
|
export TOKEN="${{ secrets.GITHUB_TOKEN }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
fi
|
|
|
|
if test -z "$TOKEN"; then
|
2023-03-30 10:28:59 -04:00
|
|
|
export TOKEN="${{ github.token }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
fi
|
|
|
|
test "$TOKEN"
|
2023-03-29 11:16:26 -04:00
|
|
|
export RELEASE_DIR="${{ inputs.release-dir }}"
|
2023-03-29 17:59:02 -04:00
|
|
|
export RELEASENOTES="${{ inputs.release-notes }}"
|
2023-03-29 11:16:26 -04:00
|
|
|
export VERBOSE="${{ inputs.verbose }}"
|
2023-03-30 02:52:59 -04:00
|
|
|
|
2023-03-29 13:29:24 -04:00
|
|
|
export SHA="${{ inputs.sha }}"
|
|
|
|
if test -z "$SHA"; then
|
|
|
|
export SHA="${{ github.sha }}"
|
|
|
|
fi
|
2023-03-29 11:16:26 -04:00
|
|
|
forgejo-release.sh ${{ inputs.direction }}
|
|
|
|
shell: bash
|