upload-release-asset
upload-release-asset copied to clipboard
Support matrix build
@imbsky did you mean to open this? I’ll close it but happy to re-open if you edit your original comment body 👍
Oh, when I hit return, it seemed to be opened...
@IAmHughes Currently a validation error occurs when uploading assets from multiple OSs to release in a matrix build. It should be fixed.
In other words, we can't upload software-name-here-x86_64-macOS-latest.tar.gz
and software-name-here-x86_64-ubuntu-latest.tar.gz
to latest release.
and I can't re-open this issue, there is no button to re-open.
I reopened it for you @imbsky, because the original issue was blank I wasn’t sure. Thanks!
Thanks for quick response!
Running into this. Trying to have a build with the following job structure:
build(mac) build(linux) build(win)
│ │ │
└──────────────────┼─────────────────┘
│
create_release()
│
┌──────────────────┼─────────────────┐
│ │ │
upload(mac) upload(linux) upload(win)
This is split into 3 jobs, 2 of which use matrices. It is not possible to run create-release
(https://github.com/actions/create-release). Because it is impossible to get outputs from previous jobs (even ones that it "needs"), and because create-release cannot be run per-matrix this setup is impossible. The build
job uses upload-artifact
, and the upload
job uses download-artifact
.
Seems to be a problem of the workflow system. To me, jobs that "need" one-another should be able to access each-others' outputs.
This supports matrix build. I don't know because I haven't read the code at all, but can't we support it with the same approach? https://github.com/softprops/action-gh-release
Hey @arlyon that looks like a good solution but one thing I can't figure out is how to get the upload_url from the create_release job to the upload jobs. Thanks!
Same issue here. Trying to upload to a release 3 assets for 3 different platforms and failing on 'create_release' when the job for the second platform is running.
Run actions/create-release@v1
##[error]Validation Failed
Any ideas?
I got around this by having a seperate job do release creation. Files needed for release can be uploaded/downloaded via artifacts.
I have the same problem, I've tried ${{ needs.create-release.outputs.upload_url }}
but it doesn't work
I have a workaround for this which creates the release first, before going into matrix mode:
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
build_release:
name: Build release
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
zip_name: plugin-linux
generator: Unix Makefiles
- os: macos-latest
zip_name: plugin-mac
generator: Xcode
- os: windows-latest
zip_name: plugin-win
generator: Visual Studio 16 2019
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install cmake gcc
- name: Install macOS dependencies
if: matrix.os == 'macOS-latest'
run: brew install cmake
- name: Install Windows dependencies
if: matrix.os == 'windows-latest'
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
choco install zip
- name: Build
shell: bash
run: cmake --build ./build --config Release
- name: Compress
shell: bash
run: |
cd ./build/VST3/Release
zip -r ../${{ matrix.zip_name }}.zip *
- name: Upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./build/VST3/${{ matrix.zip_name }}.zip
asset_name: ${{ matrix.zip_name }}.zip
asset_content_type: application/zip
You can also use the if statement if inside the matrix:
- name: Upload metadata
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./build/VST3/Release/plugin.json
asset_name: plugin.json
asset_content_type: application/json
Full source code is here: https://github.com/studiorack/studiorack-plugin/blob/master/.github/workflows/release.yml