Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

##[error]Input required and not supplied: upload_url But I have supplied the option #46

Closed
aaronliu0130 opened this issue Apr 14, 2020 · 5 comments

Comments

@aaronliu0130
Copy link

I am new to github actions, and I have tried uploading a release asset after successful release creation. However, it fails. Here is an excerpt from my actions file:

jobs:
  release:
    name: Create release
    runs-on: ubuntu-latest
    
    steps:
      - name: Create release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ join('Release v0.1.0 Last Alpha Commit ',github.sha) }}
          body: |
            We have made some features! A new step to being complete.
          draft: false
          prerelease: true
  buildm:
    name: Build on macOS
    runs-on: macos-latest
    
    steps:
      - uses: actions/checkout@v2
      - name: build
        run: echo "blablbahb" #Building shenanigans
      - name: upload asset
        id: upload-release-asset
        uses: actions/upload-release-asset@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          asset_path: ./RichmanMA
          asset_name: Richman-For-macOS
          upload_url: ${{ steps.create_release.outputs.upload_url }} #NOTE THIS LINE!

I have tried moving the upload url to top of the with stanza, and it still fails with this log:

Run actions/upload-release-asset@latest
  with:
    asset_path: ./RichmanMA
    asset_name: Richman-For-ubuntu
  env:
    GITHUB_TOKEN: ***
##[error]Input required and not supplied: upload_url

image
The entire log is over here if you wish.

@kevinlul
Copy link

You can't use job outputs between jobs, only between steps in the same job.

@aaronliu0130
Copy link
Author

I want to upload multiple files from different OSs built in the same job to the same release. How do I do that?

@jgstew
Copy link

jgstew commented May 12, 2020

I'm trying to do the same thing. I was wondering if it was possible to get the upload_url when triggering on this:

on:
  release:
    types: created

Basically, create the release either manually, or in a different action, then have a subsequent action trigger to add files for MacOS, then have a different action trigger to add files for Linux.

or does it somehow need to happen all in one job in one action?

UPDATE: does seem like it is possible, here: #34 (comment)

@nonodev96
Copy link

You can use the outputs of jobs

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjobs_idoutputs

Define the outputs:

jobs:
  Make_GitHub_Release:
    name: Create Release
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.step_version.outputs.version }}
      upload_url: ${{ steps.step_upload_url.outputs.upload_url }}
      - id: step_version
        run: echo "::set-output name=version::${{ steps.package_version.outputs.version }}"
        
      - id: step_upload_url
        run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"

Use the outputs in other jobs with needs.<job_id>.outputs

          upload_url: ${{ needs.Make_GitHub_Release.outputs.upload_url }}
          asset_path: "./release/${{ matrix.artifact_name }}"
          asset_name: "${{ matrix.asset_name }}"
          asset_content_type: ${{ matrix.asset_content_type }}

@aaronliu0130
Copy link
Author

You can use the outputs of jobs

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjobs_idoutputs

Define the outputs:

jobs:
  Make_GitHub_Release:
    name: Create Release
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.step_version.outputs.version }}
      upload_url: ${{ steps.step_upload_url.outputs.upload_url }}
      - id: step_version
        run: echo "::set-output name=version::${{ steps.package_version.outputs.version }}"
        
      - id: step_upload_url
        run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"

Use the outputs in other jobs with needs.<job_id>.outputs

          upload_url: ${{ needs.Make_GitHub_Release.outputs.upload_url }}
          asset_path: "./release/${{ matrix.artifact_name }}"
          asset_name: "${{ matrix.asset_name }}"
          asset_content_type: ${{ matrix.asset_content_type }}

Neat!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants