diff --git a/README.md b/README.md index 0758032..23bb315 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Upload or download the assets of a release to a Forgejo instance. | `token` |
Forgejo application token
| `false` | `${{ secrets.GITHUB_TOKEN }}` | | `release-dir` |Directory in whichs release assets are uploaded or downloaded
| `true` | `""` | | `release-notes` |Release notes
| `false` | `""` | +| `release-notes-file` |Path to a file containing your release notes (takes priority over `release-notes`)
| `false` | `""` | | `direction` |Can either be download or upload
GPG Private Key to sign the release artifacts
| `false` | `""` | | `gpg-passphrase` |Passphrase of the GPG Private Key
| `false` | `""` | @@ -53,6 +54,27 @@ jobs: release-notes: "MY RELEASE NOTES" ``` +Upload a release with custom release notes located in a file: + +```yaml +jobs: + upload-release: + runs-on: docker + steps: + - uses: actions/checkout@v4 + - name: Generate Changelog + run: ./generate-changelog.sh > dist/changelog.md + - uses: actions/forgejo-release@v2.7.3 + with: + direction: upload + url: https://my-forgejo-instance.net + repo: myuser/myrepo + token: ${{ secrets.WRITE_TOKEN_TO_MYREPO }} + tag: v13.0.2 + release-dir: dist/release + release-notes-file: dist/changelog.md +``` + ### Download Example downloading the forgejo release v1.21.4-0 into the working directory: diff --git a/action.yml b/action.yml index f6725c7..3ecf3ed 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,9 @@ inputs: required: true release-notes: description: 'Release notes' + release-notes-file: + description: 'Path to a file containing your release notes (takes priority over release-notes)' + required: false direction: description: 'Can either be `download` or `upload`' required: true @@ -97,6 +100,16 @@ runs: EOF ) + RELEASENOTES_FILE="${{ inputs.release-notes-file }}" + if [ ! -z "$RELEASENOTES_FILE" ]; then + if [ ! -f "$RELEASENOTES_FILE" ]; then + echo "! Release notes file $RELEASENOTES_FILE does not exist." + exit 1 + fi + + export RELEASENOTES=$(cat "$RELEASENOTES_FILE") + fi + export SHA="${{ inputs.sha }}" export OVERRIDE="${{ inputs.override }}"