Compare commits

..

No commits in common. "main" and "v2.5.3" have entirely different histories.
main ... v2.5.3

5 changed files with 40 additions and 43 deletions

View file

@ -6,7 +6,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- id: forgejo - id: forgejo
uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.11 uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.4
with: with:
user: testuser user: testuser
password: admin1234 password: admin1234

View file

@ -10,12 +10,12 @@ Upload or download the assets of a release to a Forgejo instance.
| name | description | required | default | | name | description | required | default |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `url` | <p>URL of the Forgejo instance</p> | `false` | `${{ env.GITHUB_SERVER_URL }}` | | `url` | <p>URL of the Forgejo instance</p> | `false` | `""` |
| `repo` | <p>owner/project relative to the URL</p> | `false` | `${{ github.repository }}` | | `repo` | <p>owner/project relative to the URL</p> | `false` | `""` |
| `tag` | <p>Tag of the release</p> | `false` | `${{ github.ref_name }}` | | `tag` | <p>Tag of the release</p> | `false` | `""` |
| `title` | <p>Title of the release (defaults to tag)</p> | `false` | `""` | | `title` | <p>Title of the release (defaults to tag)</p> | `false` | `""` |
| `sha` | <p>SHA of the release</p> | `false` | `${{ github.sha }}` | | `sha` | <p>SHA of the release</p> | `false` | `""` |
| `token` | <p>Forgejo application token</p> | `false` | `${{ secrets.GITHUB_TOKEN }}` | | `token` | <p>Forgejo application token</p> | `true` | `""` |
| `release-dir` | <p>Directory in whichs release assets are uploaded or downloaded</p> | `true` | `""` | | `release-dir` | <p>Directory in whichs release assets are uploaded or downloaded</p> | `true` | `""` |
| `release-notes` | <p>Release notes</p> | `false` | `""` | | `release-notes` | <p>Release notes</p> | `false` | `""` |
| `direction` | <p>Can either be <code>download</code> or <code>upload</code></p> | `true` | `""` | | `direction` | <p>Can either be <code>download</code> or <code>upload</code></p> | `true` | `""` |
@ -37,18 +37,16 @@ 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`): Upload the release located in `release-dir` to the release section of a repository (`url` and `repo`):
```yaml ```yaml
on: [tag]
jobs: jobs:
upload-release: upload-release:
runs-on: docker runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/forgejo-release@v2.6.0 - uses: actions/forgejo-release@v2
with: with:
direction: upload direction: upload
url: https://my-forgejo-instance.net url: https://code.forgejo.org
repo: myuser/myrepo
token: ${{ secrets.WRITE_TOKEN_TO_MYREPO }}
tag: v1.0.0
release-dir: dist/release release-dir: dist/release
release-notes: "MY RELEASE NOTES" release-notes: "MY RELEASE NOTES"
``` ```
@ -58,24 +56,24 @@ jobs:
Example downloading the forgejo release v1.21.4-0 into the working directory: Example downloading the forgejo release v1.21.4-0 into the working directory:
```yaml ```yaml
on: [tag]
jobs: jobs:
download-release: download-release:
runs-on: docker runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/forgejo-release@v2.6.0 - uses: actions/forgejo-release@v2
with: with:
direction: download direction: download
url: https://my-forgejo-instance.net url: https://code.forgejo.org
repo: myuser/myrepo repo: forgejo/forgejo
token: ${{ secrets.READ_TOKEN_TO_MYREPO }} tag: v1.21.4-0
tag: v1.0.0
release-dir: ./ # by default, files are downloaded into dist/release release-dir: ./ # by default, files are downloaded into dist/release
``` ```
### Real world example ### Real world example
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. 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.
## Update the `input` section of the README ## Update the `input` section of the README

View file

@ -6,21 +6,17 @@ description: |
inputs: inputs:
url: url:
description: 'URL of the Forgejo instance' description: 'URL of the Forgejo instance'
default: '${{ env.GITHUB_SERVER_URL }}'
repo: repo:
description: 'owner/project relative to the URL' description: 'owner/project relative to the URL'
default: '${{ github.repository }}'
tag: tag:
description: 'Tag of the release' description: 'Tag of the release'
default: '${{ github.ref_name }}'
title: title:
description: 'Title of the release (defaults to tag)' description: 'Title of the release (defaults to tag)'
sha: sha:
description: 'SHA of the release' description: 'SHA of the release'
default: '${{ github.sha }}'
token: token:
description: 'Forgejo application token' description: 'Forgejo application token'
default: '${{ secrets.GITHUB_TOKEN }}' required: true
release-dir: release-dir:
description: 'Directory in whichs release assets are uploaded or downloaded' description: 'Directory in whichs release assets are uploaded or downloaded'
required: true required: true
@ -61,6 +57,9 @@ runs:
shell: bash shell: bash
- run: | - run: |
export FORGEJO="${{ inputs.url }}" 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 # A trailing / will mean http://forgejo//api/v1 is used
# and it always 401 as of v1.19, because of the double slash # and it always 401 as of v1.19, because of the double slash
FORGEJO=${FORGEJO%%/} FORGEJO=${FORGEJO%%/}
@ -68,8 +67,17 @@ runs:
export HOST=${FORGEJO#*://} export HOST=${FORGEJO#*://}
export REPO="${{ inputs.repo }}" export REPO="${{ inputs.repo }}"
if test -z "$REPO"; then
export REPO="${{ github.repository }}"
fi
export TAG="${{ inputs.tag }}" 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 }}" export TITLE="${{ inputs.title }}"
@ -91,6 +99,9 @@ runs:
) )
export SHA="${{ inputs.sha }}" export SHA="${{ inputs.sha }}"
if test -z "$SHA"; then
export SHA="${{ github.sha }}"
fi
export OVERRIDE="${{ inputs.override }}" export OVERRIDE="${{ inputs.override }}"

View file

@ -1,18 +1,6 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>actions/renovate-config"], "extends": [
"customManagers": [ "local>actions/renovate-config"
{ ]
"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"
}
]
} }

View file

@ -12,7 +12,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- id: forgejo - id: forgejo
uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.11 uses: https://code.forgejo.org/actions/setup-forgejo@v1.0.1
with: with:
user: testuser user: testuser
password: admin1234 password: admin1234