Merge matrix build artifacts for release

I am using a matrix configuration to compile my project on different platforms and want to merge all the outputs to one single release.

jobs:
  build:
    name: ${{ matrix.config.name }}
    runs-on: ${{ matrix.config.os }}

I already uploaded all artifacts to the workflow, but I still need to put them into a new release

    - name: Upload artifacts
      uses: actions/upload-artifact@v2
      with:
        name: ${{ matrix.config.artifact }}
        path: build/app*

You could create a job that depends on the jobs that build your artifacts https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds. You can then have that job download all of the artifacts using https://github.com/actions/download-artifact and upload those as release assets.

Hi @thebino,

You can create a new job which needs your matrix jobs, in the new job, you can

  1. Download the artifacts to one folder.
  2. Create a new release with action ‘actions/create-release@v1’.
  3. Use ‘hub release edit’ command to add the asset(your artifacts) to the release
    Code sample as below:
      - name: Create Release          # create a new release v1
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: v1
          release_name: Release v1
          draft: false
          prerelease: false
      - name: Attach binaries to release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          set -x
          assets=()
          for asset in ./bin/*; do               #loop the assets in the bin folder
            assets+=("-a" "$asset")
          done
          hub release edit "${assets[@]}" -m "Release v1" "v1"          # add the assets to the Release v1

Please check my answer in similar ticket here for your reference.

You can use github actions to add assets as well, which you can find in marketplace here.

Thanks.

Thanks, I didn’t knew that I can download ALL artifacts together.
I solved it in a separate job and used a 3rd party action for uploads

    - name: Download artifact
      uses: actions/download-artifact@v2

    - name: Upload to Release
      uses: meeDamian/github-release@2.0
1 Like

Hi @thebino,

Glad to know it’s resolved and thanks for sharing!

Happy coding!