Coder Social home page Coder Social logo

upload-to-release's Introduction

Upload to Release

A GitHub Action that uploads a file to a new release.

Usage

This action uploads any file to a new release:

image

One example workflow is to build and save a Docker image then upload it to a release:

# .github/workflows/build-docker-image.yml
name: build-docker-image

on: 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.

- 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):

- 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.