Closed aaronliu0130 closed 4 years ago
You can't use job outputs between jobs, only between steps in the same job.
I want to upload multiple files from different OSs built in the same job to the same release. How do I do that?
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: https://github.com/actions/upload-release-asset/issues/34#issuecomment-597499295
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 }}
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!
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:
I have tried moving the upload url to top of the
with
stanza, and it still fails with this log:The entire log is over here if you wish.