https://github.com/cloudnode-pro/release-upload-asset
Upload files to a GitHub release
https://github.com/cloudnode-pro/release-upload-asset
Last synced: 8 months ago
JSON representation
Upload files to a GitHub release
- Host: GitHub
- URL: https://github.com/cloudnode-pro/release-upload-asset
- Owner: cloudnode-pro
- License: gpl-3.0
- Created: 2024-12-08T14:03:16.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-31T13:34:56.000Z (about 1 year ago)
- Last Synced: 2025-03-31T14:46:42.837Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 140 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Release: Upload Asset
Upload files to a GitHub release.
## Example Usage
```yaml
# …
jobs:
publish:
# …
permissions:
contents: write
# …
steps:
# …
- name: Upload to release
uses: cloudnode-pro/release-upload-asset@v1
with:
# See the ‘Inputs’ section below for details.
gh-token: ${{ github.token }}
release-id: 123456 # Optional for `release` events.
files: |
path/to/file.txt; type=text/plain; name=File1.txt
path/to/foo/bar.baz; if=${{ github.event_name == 'release' }}
```
## Inputs
### `gh-token`
The GitHub token to use for authentication.
If you are uploading to a release in the same repository, you can use `${{github.token}}`, which is a secret
generated by the workflow. Otherwise, you need to manually create a token, save it as a repository secret, and pass it
using `${{secrets.NAME_OF_SECRET}}`.
### `release-id`
The ID of the release to which to upload files.
This is optional for `release` events, in which case the ID can be inferred (if left unset) from the release that
triggered the workflow.
### `files`
Paths to the files to upload. Separated by newline.
After the file path, you can add parameters separated by semicolons.
The recognised parameters are:
type- The MIME type of the file. Defaults to
application/octet-stream.
name- The name of the file. Defaults to the basename of the file path.
if- Whether to actually upload this file. You can use this in combination with
GitHub expressions.
The allowed values aretrueandfalse. Defaults totrue.
Examples:
```yaml
files: |-
/path/to/file1.txt
/path/to/file2.txt; type=text/plain; name=Named File.txt
/path/to/file3.txt; if=${{ 'foo' == 'bar' }}
```
### Permissions
Uploading release assets requires the `contents: write`.
See: [Controlling permissions for GITHUB_TOKEN](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token)
Example:
```yaml
permissions:
contents: write
```