actions / upload-artifact

MIT License
3.01k stars 683 forks source link

Add sub-action to merge artifacts #505

Closed robherley closed 5 months ago

robherley commented 5 months ago

Follow up to:

Part of:

This introduces a new sub-action, actions/upload-artifact/merge@v4 that facilitates merging one or more artifacts from a workflow.

For instance, the following is now possible:

jobs:
  upload:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        foo: [a, b, c]

    steps:
      - name: Run a one-line script
        run: echo "hello from job ${{ matrix.foo }}" > file-${{ matrix.foo }}.txt
      - name: Upload
        uses: actions/upload-artifact@v4
        with:
          name: my-artifact-${{ matrix.foo }}
          path: file-${{ matrix.foo }}.txt
  merge:
    runs-on: ubuntu-latest
    needs: upload

    steps:
      - name: Merge Artifacts
        uses: actions/upload-artifact/merge@v4
        with:
          name: my-merged-artifact
          pattern: my-artifact-*

Where all the contents of my-artifact-a, my-artifact-b, my-artifact-c will be in a single artifact called my-merged-artifact.