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

Upload to specific artifact directory #344

Open
bourneagain opened this issue Aug 30, 2022 · 2 comments · May be fixed by #380
Open

Upload to specific artifact directory #344

bourneagain opened this issue Aug 30, 2022 · 2 comments · May be fixed by #380
Labels
enhancement New feature or request

Comments

@bourneagain
Copy link

What would you like to be added?

Currently there seems to be no way (correct me please otherwise) to upload to specific directory (or create a new directory and upload within that) part of the artifact_upload API.

Why is this needed?

This is needed in cases such as differentiating release vs debug builds. This feature will give ability to have the artifacts uploaded under their respective directories (debug/release).

@bourneagain bourneagain added the enhancement New feature or request label Aug 30, 2022
@carlcsaposs-canonical
Copy link

+1

I'd like to be able to specify the rootDirectory used by @actions/artifact to preserve directory structure.

Use case: uploading multiple files to the same artifact when using GitHub actions matrix

Here's a simplified example:

jobs:
  build:
    strategy:
      matrix:
        charm:
          - name: mysql
            path: .
          - name: ha-test-application
            path: tests/integration/high_availability/application_charm
          - name: relations-test-application
            path: tests/integration/relations/application-charm
    name: Build ${{ matrix.charm.name }} charm
    runs-on: ubuntu-latest
    steps:
      - name: Pack charm
        working-directory: ${{ matrix.charm.path }}
        run: charmcraft pack
      - name: Upload packed charm
        uses: actions/upload-artifact@v3
        with:
          name: packed-charms
          path: ${{ matrix.charm.path }}/foo.charm
          # possible syntax to specify rootDirectory?
          root-directory: .

In this example, the final artifact should look like:

foo.charm
tests/integration/high_availability/application_charm/foo.charm
tests/integration/relations/application-charm/foo.charm

Currently, the upload-artifact action overrides the files and the final artifact looks like:

foo.charm

The workaround we're currently using is adding a .empty file to path
(e.g.

path: |
  ${{ matrix.charm.path }}/foo.charm
  .empty

) so that the directory structure is preserved.

carlcsaposs-canonical added a commit to carlcsaposs-canonical/upload-artifact that referenced this issue Jan 13, 2023
@atsju
Copy link

atsju commented Feb 24, 2023

may be related to #248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants