Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experiment] merge sub-action #503

Closed
wants to merge 10 commits into from
Closed

Conversation

robherley
Copy link
Contributor

@robherley robherley commented Jan 19, 2024

Reorganizing and adding sub-action to "merge" artifacts.

For the simplest use-case, it would look something like:

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

Without any inputs, the above would merge the three my-artifact-* actions into merged-artifact. There are of course multiple options to adjust the behavior and refine, e.g.

  merge:
    runs-on: ubuntu-latest
    needs: upload
    steps:
      - name: Merge Artifacts
        uses: actions/upload-artifact/merge@v4
        with:
          # the name of the merged artifact
          into: my-merged-artifact
          # the pattern to match artifacts to merge
          pattern: my-artifact-*
          # whether or not to place the artifacts into separate directories
          separate-directories: false
          # to delete the artifacts after merging
          delete-merged: true
          # retention days, same as the upload action
          retention-days: 90
          # compression level, same as the upload action
          compression-level: 9

This PR does change a lot to the structure of the repo, so I'll probably split it into two to make it easier to review:

  1. Moving the upload logic into it's own directory + unit tests
  2. Adding the merge sub-action, docs + unit tests

Here's an example run: https://github.com/robherley/tmp-merge-artifacts/actions/runs/7586676926

@robherley
Copy link
Contributor Author

This was added in release v4.3.0

@robherley robherley closed this Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant