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

Unable to upload a folder as an artifact #248

Open
gxferreira opened this issue Sep 16, 2021 · 5 comments
Open

Unable to upload a folder as an artifact #248

gxferreira opened this issue Sep 16, 2021 · 5 comments

Comments

@gxferreira
Copy link

It seems impossible to upload a specific folder as an artifact. In my case, I'd like to simply upload the directory dist instead of its content. My code is similar to this example.

      - name: Uploading dist
        uses: actions/upload-artifact@v2
        with:
          name: artefact
          path: ./dist

I tried another variations using wildcards but I didn't succeed uploading the dist within my artifact.
Isn't possible with this action?

@Powersource
Copy link

My config looking like this has worked

      - uses: actions/upload-artifact@v2
        if: failure()
        with:
          name: cypress-artifacts
          path: |
            cypress/screenshots/
            cypress/videos/

I think there also has to be things in the folder or it'll skip it

@andrewsw
Copy link

Is this still a thing? I believe the problem here is that this action won't upload files that are .gitignored. At least that seems to be what I'm seeing.

@stefanalfbo
Copy link

I had a similar problem with my workflow. However the problem in my case was that I thought by setting a default value for the working directory it should be applied in all steps, but it only applies on the run steps.

So for the upload-artifact action I had to include the complete path from the root of the repository, like this:

jobs:
  run-playwright-tests:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./tests/e2e
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: "14.x"
      - name: Install dependencies
        run: npm ci
      - name: Install Playwright
        run: npx playwright install --with-deps
      - name: Run Playwright tests
        run: npx playwright test
      - uses: actions/upload-artifact@v3
        if: always()
        with:
          name: playwright-report
          path: |
            tests/e2e/playwright-report/
          retention-days: 15

@andrewsw
Copy link

Ah, yeah. That's what I ultimately discovered, as well. The action doesn't respect working-directory.

@micl2e2
Copy link

micl2e2 commented Nov 12, 2023

Here is a simple workaround, add one more step, just before the upload-artifact step:

      ...
      ...
      - run: mkdir tmp-dir && mv dist tmp-dir/ && mv tmp-dir dist
      - name: Uploading dist
        uses: actions/upload-artifact@v2
        with:
          name: artefact
          path: ./dist
      ...
      ...

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

No branches or pull requests

5 participants