Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jasonetco/upload-to-release
A GitHub Action that uploads a file to a new release.
https://github.com/jasonetco/upload-to-release
action github-actions release-automation workflow
Last synced: 6 days ago
JSON representation
A GitHub Action that uploads a file to a new release.
- Host: GitHub
- URL: https://github.com/jasonetco/upload-to-release
- Owner: JasonEtco
- License: mit
- Created: 2018-12-04T14:33:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-02T12:36:15.000Z (over 4 years ago)
- Last Synced: 2024-10-25T21:50:38.895Z (26 days ago)
- Topics: action, github-actions, release-automation, workflow
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 177
- Watchers: 4
- Forks: 39
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Upload to Release
A GitHub Action that uploads a file to a new release.
## Usage
This action uploads any file to a new release:
One example workflow is to build and save a Docker image then upload it to a release:
```yaml
# .github/workflows/build-docker-image.yml
name: build-docker-imageon: release
jobs:
build-docker-image:
name: Build and upload docker image
runs-on: ubuntu-latest
steps:
- name: Pull source
uses: actions/checkout@v1- name: Build Docker image
uses: actions/docker/cli@master
with:
args: build . -t my-image- name: Save the image
uses: actions/docker/cli@master
with:
args: save my-image:latest- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: my-image.tar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```## Requirements
You must pass at least one argument, the path to the file you want to attach. You must also include the `GITHUB_TOKEN` secret, otherwise uploading the file will not work.
```yaml
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: my-image.tar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```### Content-Type
You may also need to pass an additional argument, the `Content-Type` header used when uploading your file (this is `application/zip` by default):
```yaml
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: my-image.tar application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```### Event type
The event type your workflow is triggered from is critical to the function of this action. If you are not using `on: release` for your workflow this action will not work correctly.
The event sent to the action by GitHub only contains an artifact upload URL when using the `release` event type to trigger the workflow.
If you need other workflows not based on the `release` event, you should use multiple workflow definitions.