mirror of
https://code.forgejo.org/actions/forgejo-release.git
synced 2025-04-22 17:10:49 +00:00
Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
|
cb5b30e358 | ||
|
f0a9704521 | ||
|
73fec07c28 | ||
|
dccbd17bd8 | ||
|
bc1ca37df0 | ||
|
a198449381 | ||
|
a6e3fdb19e |
5 changed files with 43 additions and 40 deletions
|
@ -6,7 +6,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
|
||||
- id: forgejo
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.4
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.11
|
||||
with:
|
||||
user: testuser
|
||||
password: admin1234
|
||||
|
|
38
README.md
38
README.md
|
@ -10,12 +10,12 @@ 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` | `""` |
|
||||
| `repo` | <p>owner/project relative to the URL</p> | `false` | `""` |
|
||||
| `tag` | <p>Tag of the release</p> | `false` | `""` |
|
||||
| `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 }}` |
|
||||
| `title` | <p>Title of the release (defaults to tag)</p> | `false` | `""` |
|
||||
| `sha` | <p>SHA of the release</p> | `false` | `""` |
|
||||
| `token` | <p>Forgejo application token</p> | `true` | `""` |
|
||||
| `sha` | <p>SHA of the release</p> | `false` | `${{ github.sha }}` |
|
||||
| `token` | <p>Forgejo application token</p> | `false` | `${{ secrets.GITHUB_TOKEN }}` |
|
||||
| `release-dir` | <p>Directory in whichs release assets are uploaded or downloaded</p> | `true` | `""` |
|
||||
| `release-notes` | <p>Release notes</p> | `false` | `""` |
|
||||
| `direction` | <p>Can either be <code>download</code> or <code>upload</code></p> | `true` | `""` |
|
||||
|
@ -37,16 +37,18 @@ Upload or download the assets of a release to a Forgejo instance.
|
|||
Upload the release located in `release-dir` to the release section of a repository (`url` and `repo`):
|
||||
|
||||
```yaml
|
||||
on: [tag]
|
||||
jobs:
|
||||
upload-release:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/forgejo-release@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/forgejo-release@v2.6.0
|
||||
with:
|
||||
direction: upload
|
||||
url: https://code.forgejo.org
|
||||
url: https://my-forgejo-instance.net
|
||||
repo: myuser/myrepo
|
||||
token: ${{ secrets.WRITE_TOKEN_TO_MYREPO }}
|
||||
tag: v1.0.0
|
||||
release-dir: dist/release
|
||||
release-notes: "MY RELEASE NOTES"
|
||||
```
|
||||
|
@ -56,24 +58,24 @@ jobs:
|
|||
Example downloading the forgejo release v1.21.4-0 into the working directory:
|
||||
|
||||
```yaml
|
||||
on: [tag]
|
||||
jobs:
|
||||
download-release:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/forgejo-release@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/forgejo-release@v2.6.0
|
||||
with:
|
||||
direction: download
|
||||
url: https://code.forgejo.org
|
||||
repo: forgejo/forgejo
|
||||
tag: v1.21.4-0
|
||||
url: https://my-forgejo-instance.net
|
||||
repo: myuser/myrepo
|
||||
token: ${{ secrets.READ_TOKEN_TO_MYREPO }}
|
||||
tag: v1.0.0
|
||||
release-dir: ./ # by default, files are downloaded into dist/release
|
||||
```
|
||||
|
||||
### Real world example
|
||||
|
||||
This action is used to [publish](https://code.forgejo.org/forgejo/release-notes-assistant/src/branch/main/.forgejo/workflows/release.yml) the release notes assistant assets.
|
||||
This action is used to [publish](https://code.forgejo.org/forgejo/release-notes-assistant/src/commit/09f2c22d80d5ee655783cfeb2c1d4bab4afec3e4/.forgejo/workflows/release.yml) the release notes assistant assets.
|
||||
|
||||
## Update the `input` section of the README
|
||||
|
||||
|
|
21
action.yml
21
action.yml
|
@ -6,17 +6,21 @@ description: |
|
|||
inputs:
|
||||
url:
|
||||
description: 'URL of the Forgejo instance'
|
||||
default: '${{ env.GITHUB_SERVER_URL }}'
|
||||
repo:
|
||||
description: 'owner/project relative to the URL'
|
||||
default: '${{ github.repository }}'
|
||||
tag:
|
||||
description: 'Tag of the release'
|
||||
default: '${{ github.ref_name }}'
|
||||
title:
|
||||
description: 'Title of the release (defaults to tag)'
|
||||
sha:
|
||||
description: 'SHA of the release'
|
||||
default: '${{ github.sha }}'
|
||||
token:
|
||||
description: 'Forgejo application token'
|
||||
required: true
|
||||
default: '${{ secrets.GITHUB_TOKEN }}'
|
||||
release-dir:
|
||||
description: 'Directory in whichs release assets are uploaded or downloaded'
|
||||
required: true
|
||||
|
@ -57,9 +61,6 @@ runs:
|
|||
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%%/}
|
||||
|
@ -67,17 +68,8 @@ runs:
|
|||
export HOST=${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 TITLE="${{ inputs.title }}"
|
||||
|
||||
|
@ -99,9 +91,6 @@ runs:
|
|||
)
|
||||
|
||||
export SHA="${{ inputs.sha }}"
|
||||
if test -z "$SHA"; then
|
||||
export SHA="${{ github.sha }}"
|
||||
fi
|
||||
|
||||
export OVERRIDE="${{ inputs.override }}"
|
||||
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"local>actions/renovate-config"
|
||||
"extends": ["local>actions/renovate-config"],
|
||||
"customManagers": [
|
||||
{
|
||||
"customType": "regex",
|
||||
"description": "update example in README.md",
|
||||
"fileMatch": ["^README.md$"],
|
||||
"matchStrings": [
|
||||
"uses: actions/forgejo-release@(?<currentValue>v\\d+\\.\\d+\\.\\d+)"
|
||||
],
|
||||
"datasourceTemplate": "gitea-tags",
|
||||
"depNameTemplate": "actions/forgejo-release",
|
||||
"versioningTemplate": "semver",
|
||||
"registryUrlTemplate": "https://code.forgejo.org"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: forgejo
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v1.0.1
|
||||
uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.11
|
||||
with:
|
||||
user: testuser
|
||||
password: admin1234
|
||||
|
|
Loading…
Add table
Reference in a new issue