mirror of
https://code.forgejo.org/actions/forgejo-release.git
synced 2026-02-04 14:58:08 +00:00
Compare commits
14 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5fa0f2e61 | ||
|
|
21f672cae6 | ||
|
|
454bc2681f | ||
|
|
4b5fdf8538 | ||
|
|
5c6400d871 | ||
|
|
a1314c9c65 | ||
|
|
7fdceaa4f8 | ||
|
|
2c623db48b | ||
|
|
5abb3c3dd1 | ||
|
|
1e356ba621 | ||
|
|
b93b6e8f70 | ||
|
|
f5b4441975 | ||
|
|
50cc69b340 | ||
|
|
5ce5ec1ef1 |
8 changed files with 111 additions and 30 deletions
|
|
@ -1,9 +1,11 @@
|
|||
on: [ pull_request, push ]
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
env:
|
||||
FORGEJO_VERSION: 11.0.9 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
|
||||
|
||||
FORGEJO_VERSION: 11.0.10 # renovate: datasource=docker depName=data.forgejo.org/forgejo/forgejo
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
|
|
@ -12,7 +14,7 @@ jobs:
|
|||
- uses: actions/checkout@v6
|
||||
|
||||
- id: forgejo
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v3.1.0
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v3.1.3
|
||||
with:
|
||||
user: testuser
|
||||
password: admin1234
|
||||
|
|
@ -68,7 +70,7 @@ jobs:
|
|||
testdata/forgejo-release-test.sh test_run testuser otherrepo
|
||||
|
||||
- if: always()
|
||||
name: '[RUNNER] and [FORGEJO] logs'
|
||||
name: "[RUNNER] and [FORGEJO] logs"
|
||||
run: |
|
||||
runner_logs="${{ steps.forgejo.outputs.runner-logs }}"
|
||||
if test -f "$runner_logs"; then
|
||||
|
|
|
|||
23
.forgejo/workflows/release.yml
Normal file
23
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: docker
|
||||
|
||||
steps:
|
||||
# needs to be in a different dir, so binary and rna cache don't conflict
|
||||
- uses: https://data.forgejo.org/actions/checkout@v6
|
||||
with:
|
||||
path: forgejo-release
|
||||
|
||||
- name: publish release
|
||||
uses: ./forgejo-release
|
||||
with:
|
||||
direction: upload
|
||||
override: ${{ vars.OVERRIDE || 'false' }}
|
||||
verbose: ${{ vars.VERBOSE || 'false' }}
|
||||
release-notes-assistant: true
|
||||
skip-assets: true
|
||||
|
|
@ -1,10 +1,27 @@
|
|||
on: [ pull_request, push ]
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: data.forgejo.org/oci/node:24-trixie
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: lint action-docs
|
||||
run: |
|
||||
npx --yes action-docs -u
|
||||
git diff --quiet || {
|
||||
echo "[ERROR] Please apply the changes action-docs suggests:"
|
||||
git diff --color=always
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Unit tests of the supporting script forgejo-release.sh
|
||||
run: |
|
||||
testdata/forgejo-release-test.sh test_system_tea_bin
|
||||
|
|
|
|||
19
README.md
19
README.md
|
|
@ -10,13 +10,13 @@ Upload or download the assets of a release to a Forgejo instance.
|
|||
|
||||
| name | description | required | default |
|
||||
| --- | --- | --- | --- |
|
||||
| `url` | <p>URL of the Forgejo instance</p> | `false` | `${{ env.GITHUB_SERVER_URL }}` |
|
||||
| `repo` | <p>owner/project relative to the URL</p> | `false` | `${{ github.repository }}` |
|
||||
| `tag` | <p>Tag of the release</p> | `false` | `${{ github.ref_name }}` |
|
||||
| `url` | <p>URL of the Forgejo instance</p> | `false` | `${{ env.FORGEJO_SERVER_URL }}` |
|
||||
| `repo` | <p>owner/project relative to the URL</p> | `false` | `${{ forge.repository }}` |
|
||||
| `tag` | <p>Tag of the release</p> | `false` | `${{ forge.ref_name }}` |
|
||||
| `title` | <p>Title of the release (defaults to tag)</p> | `false` | `""` |
|
||||
| `sha` | <p>SHA of the release</p> | `false` | `${{ github.sha }}` |
|
||||
| `token` | <p>Forgejo application token (must have `write:repository`)</p> | `false` | `${{ secrets.GITHUB_TOKEN }}` |
|
||||
| `release-dir` | <p>Directory in whichs release assets are uploaded or downloaded</p> | `true` | `""` |
|
||||
| `sha` | <p>SHA of the release</p> | `false` | `${{ forge.sha }}` |
|
||||
| `token` | <p>Forgejo application token (must have <code>write:repository</code>)</p> | `false` | `${{ forge.token }}` |
|
||||
| `release-dir` | <p>Directory in which release assets are uploaded or downloaded</p> | `false` | `dist/release` |
|
||||
| `release-notes` | <p>Release notes</p> | `false` | `""` |
|
||||
| `direction` | <p>Can either be <code>download</code> or <code>upload</code></p> | `true` | `""` |
|
||||
| `gpg-private-key` | <p>GPG Private Key to sign the release artifacts</p> | `false` | `""` |
|
||||
|
|
@ -28,6 +28,7 @@ Upload or download the assets of a release to a Forgejo instance.
|
|||
| `prerelease` | <p>Mark Release as Pre-Release</p> | `false` | `false` |
|
||||
| `release-notes-assistant` | <p>Generate release notes with Release Notes Assistant</p> | `false` | `false` |
|
||||
| `hide-archive-link` | <p>Hide the archive links</p> | `false` | `false` |
|
||||
| `skip-assets` | <p>Skip uploading release assets</p> | `false` | `false` |
|
||||
<!-- action-docs-inputs source="action.yml" -->
|
||||
|
||||
## Examples
|
||||
|
|
@ -42,7 +43,7 @@ jobs:
|
|||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/forgejo-release@v2.7.3
|
||||
- uses: actions/forgejo-release@v2.9.1
|
||||
with:
|
||||
direction: upload
|
||||
url: https://my-forgejo-instance.net
|
||||
|
|
@ -63,7 +64,7 @@ jobs:
|
|||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/forgejo-release@v2.7.3
|
||||
- uses: actions/forgejo-release@v2.9.1
|
||||
with:
|
||||
direction: download
|
||||
url: https://my-forgejo-instance.net
|
||||
|
|
@ -83,5 +84,5 @@ Using [action-docs](https://github.com/npalm/action-docs):
|
|||
|
||||
```shell
|
||||
# Edit the action.yml file and run:
|
||||
action-docs --update-readme
|
||||
npx action-docs --update-readme
|
||||
```
|
||||
|
|
|
|||
23
action.yml
23
action.yml
|
|
@ -19,11 +19,11 @@ inputs:
|
|||
description: 'SHA of the release'
|
||||
default: '${{ forge.sha }}'
|
||||
token:
|
||||
description: 'Forgejo application token'
|
||||
description: 'Forgejo application token (must have `write:repository`)'
|
||||
default: '${{ forge.token }}'
|
||||
release-dir:
|
||||
description: 'Directory in whichs release assets are uploaded or downloaded'
|
||||
required: true
|
||||
description: 'Directory in which release assets are uploaded or downloaded'
|
||||
default: 'dist/release'
|
||||
release-notes:
|
||||
description: 'Release notes'
|
||||
direction:
|
||||
|
|
@ -37,22 +37,25 @@ inputs:
|
|||
description: 'Number of times to retry if the release is not ready (default 1)'
|
||||
download-latest:
|
||||
description: 'Download the latest release'
|
||||
default: false
|
||||
default: 'false'
|
||||
verbose:
|
||||
description: 'Increase the verbosity level'
|
||||
default: false
|
||||
default: 'false'
|
||||
override:
|
||||
description: 'Override an existing release by the same `{tag}`'
|
||||
default: false
|
||||
default: 'false'
|
||||
prerelease:
|
||||
description: 'Mark Release as Pre-Release'
|
||||
default: false
|
||||
default: 'false'
|
||||
release-notes-assistant:
|
||||
description: 'Generate release notes with Release Notes Assistant'
|
||||
default: false
|
||||
default: 'false'
|
||||
hide-archive-link:
|
||||
description: 'Hide the archive links'
|
||||
default: false
|
||||
default: 'false'
|
||||
skip-assets:
|
||||
description: Skip uploading release assets
|
||||
default: 'false'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
|
@ -113,5 +116,7 @@ runs:
|
|||
echo -n "${{ inputs.gpg-passphrase }}" > $TMP_DIR/gpg-passphrase
|
||||
export GPG_PASSPHRASE="$TMP_DIR/gpg-passphrase"
|
||||
|
||||
export SKIP_ASSETS="${{ inputs.skip-assets }}"
|
||||
|
||||
forgejo-release.sh ${{ inputs.direction }}
|
||||
shell: bash
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ if ${VERBOSE:-false}; then set -x; fi
|
|||
: ${HIDE_ARCHIVE_LINK:=false}
|
||||
: ${RETRY:=1}
|
||||
: ${DELAY:=10}
|
||||
: ${SKIP_ASSETS:=false}
|
||||
|
||||
RELEASE_NOTES_ASSISTANT_VERSION=v1.5.1 # renovate: datasource=forgejo-releases depName=forgejo/release-notes-assistant registryUrl=https://code.forgejo.org
|
||||
|
||||
|
|
@ -84,9 +85,11 @@ upload_release() {
|
|||
# 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
|
||||
local assets=()
|
||||
if [ "$SKIP_ASSETS" == 'false' ]; then
|
||||
for file in "$RELEASE_DIR"/*; do
|
||||
assets=("${assets[@]}" -a "$file")
|
||||
done
|
||||
fi
|
||||
if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then
|
||||
releaseType="--prerelease"
|
||||
echo "Uploading as Pre-Release"
|
||||
|
|
@ -207,7 +210,7 @@ download() {
|
|||
(
|
||||
mkdir -p $RELEASE_DIR
|
||||
cd $RELEASE_DIR
|
||||
if [[ ${DOWNLOAD_LATEST} == "true" ]]; then
|
||||
if [[ ${DOWNLOAD_LATEST} = "true" ]]; then
|
||||
echo "Downloading the latest release"
|
||||
api GET repos/$REPO/releases/latest >"$TMP_DIR"/assets.json
|
||||
elif [[ ${DOWNLOAD_LATEST} == "false" ]]; then
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- id: forgejo
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v3.1.0
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v3.1.3
|
||||
with:
|
||||
user: testuser
|
||||
password: admin1234
|
||||
|
|
|
|||
|
|
@ -92,5 +92,35 @@ jobs:
|
|||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
diff -u upload-dir-v3 download-dir-v3
|
||||
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
id: release-upload-v4
|
||||
uses: SELF@vTest
|
||||
with:
|
||||
direction: upload
|
||||
tag: v4.0
|
||||
token: FORGEJO_TEST_TOKEN
|
||||
skip-assets: true
|
||||
verbose: true
|
||||
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
id: release-download-v4
|
||||
uses: SELF@vTest
|
||||
with:
|
||||
direction: download
|
||||
tag: v4.0
|
||||
token: FORGEJO_TEST_TOKEN
|
||||
release-dir: download-dir-v4
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
if [ ! -d download-dir-v4 ]; then
|
||||
echo "Missing download dir"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -z "$( ls -A download-dir-v4 )" ]; then
|
||||
echo "Unexpected download files: $( ls -A download-dir-v4 )"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- if: failure()
|
||||
run: docker logs forgejo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue