actions / upload-release-asset

An Action to upload a release asset via the GitHub Release API
MIT License
688 stars 190 forks source link

Optional upload url for release events #41

Closed CurtisHughes closed 1 year ago

CurtisHughes commented 4 years ago

This would allow users to upload assets to a release without providing an upload url.

It uses the Github context to determine if the action was a release-event-release (i.e. published, deleted, prereleased) and fetches the upload url based on the current actions release id.

on:
  release:
    types:
      - published

jobs:
  build:
    name: Upload Release Asset
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Build project # This would actually build your project, using zip for an example artifact
        run: |
          zip --junk-paths my-artifact README.md
      - name: Upload Release Asset
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          asset_path: ./my-artifact.zip
          asset_name: my-artifact.zip
          asset_content_type: application/zip
liuchong commented 4 years ago

I need this, actually I've made a similar change and then found this pull request 😹 Please merge 👀

liuchong commented 4 years ago

I provided my solution, any one is ok for me to merge: https://github.com/actions/upload-release-asset/pull/45

giansalex commented 4 years ago

Is very usefull, i had to use actions/github-action-publish-binaries

clementlecorre commented 3 years ago

I need this too! 👍