Visitar URL original
files option does not respect working-directory setting · Issue #458 · softprops/action-gh-release · GitHub
Skip to content

files option does not respect working-directory setting #458

Closed

Description

@jerryc05

files option does not seem to respect jobs.<job_name>.defaults.run.working-directory from github. I have to prepend working directory path to every file under files for gh actions to find the correct file.

Activity

  1. softprops commented on May 28, 2024

    @softprops
    Owner

    Can you share a link to your workflow? There's nothing in particular we do to manage your working directories. I believe the configuration option you mentioned simply switches the working directory before running the action rather than providing the job steps' working-directory input

  2. jerryc05 commented on May 28, 2024

    @jerryc05
    Author

    here is an excerpt, hope this helps:

    
    jobs:
      build_and_deploy:
        runs-on: ubuntu-latest
        defaults:
          run:
            working-directory: ./frontend
    
        steps:
          - uses: actions/checkout@v4
    
          - uses: pnpm/action-setup@v4
            with:
              version: latest
              run_install: false
    
          - shell: bash
            run: |
              echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
    
          - uses: actions/cache@v4
            with:
              path: ${{ env.STORE_PATH }}
              key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
              restore-keys: |
                ${{ runner.os }}-pnpm-store-
    
          - run: pnpm i
    
          - name: Build
            run: pnpm run dist
    
          - name: Deploy to GitHub release
            uses: softprops/action-gh-release@v2
            with:
              files: frontend/dist/*.zip
              tag_name: zipped_dist
    

    where pnpm run dist command packages everything into a zip file.

    If this workflow looks good to you, I can try to provide a minimal reproducible repo.

  3. softprops commented on May 28, 2024

    @softprops
    Owner

    I think I see the issue

    the following settings the working directory for each step. think of it like the PWD path when executing a step

        defaults:
          run:
            working-directory: ./frontend

    In your files declaration you provide the patternfrontend/dist/*.zip which will be resolved while you are in the frontend directory which would assume a path more like frontend/frontend/dist/*.zip because its relative to the working-directory for the step.

          - name: Deploy to GitHub release
            uses: softprops/action-gh-release@v2
            with:
              files: frontend/dist/*.zip

    Could you try and remove the frontend prefix from that step? Since the working-directory is frontend that would then resolve to something like frontend/dist/*.zip

          - name: Deploy to GitHub release
            uses: softprops/action-gh-release@v2
            with:
              files: dist/*.zip
  4. jerryc05 commented on Jun 3, 2024

    @jerryc05
    Author

    afaik,

            with:
              files: frontend/dist/*.zip
    

    is working (current working version of my workflow), but

            with:
              files: dist/*.zip
    

    does not work (cannot find anything matching *.zip) (my initial not-working version)

  5. softprops commented on Jun 3, 2024

    @softprops
    Owner

    What happens when you remove the frontend part of the path after setting the working directory to frontend?

  6. jerryc05 commented on Jun 3, 2024

    @jerryc05
    Author

    IMG_0627

  7. gust-p commented on Aug 13, 2024

    @gust-p

    I am having the very same issue. In my case is pretty much the same but is a rust application.

  8. urbanswelt commented on Jan 18, 2025

    @urbanswelt

    I ran some pwd commands just to see where the files were lying around, maybe this is a idea ?
    My example .....

    name: Asset Upload
    
    on:
        release:
          types:
            - published
    
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - name: Checkout
            uses: actions/checkout@v4
          - name: Build
            run: echo ${{ github.sha }} > Release.txt
          - name: Zip Folder
            run: |
              cd ../ # I added this
              rm -rf FS25_SiloKing.zip
              zip -r FS25_SiloKing.zip FS25_SiloKing -x ".git/*" ".github/*"
              echo "#### Zip Done ####"
              pwd
              ls -l
          - name: Test
            run: cat Release.txt
          - name: Release
            uses: softprops/action-gh-release@v2
            if: startsWith(github.ref, 'refs/tags/')
            with:
              files: ../FS25_SiloKing.zip
    
    
    
    #### Zip Done ####
    /home/runner/work/FS25_SiloKing
    total 8836
    drwxr-xr-x 7 runner docker    4096 Jan 18 15:40 FS25_SiloKing
    -rw-r--r-- 1 runner docker 904[232](https://github.com/urbanswelt/FS25_SiloKing/actions/runs/12845323723/job/35819263268#step:4:233)3 Jan 18 15:40 FS25_SiloKing.zip
    
    Run softprops/action-gh-release@v2
    Found release 2.0.0 🌈 (with id=19[5](https://github.com/urbanswelt/FS25_SiloKing/actions/runs/12845323723/job/35819263268#step:6:6)467473)
    ⬆️ Uploading FS25_SiloKing.zip...
    ✅ Uploaded FS25_SiloKing.zip
    🎉 Release ready at https://github.com/urbanswelt/FS25_SiloKing/releases/tag/2.0.0
    
  9. chenrui333 commented on Oct 7, 2025

    @chenrui333
    Collaborator

    released @stephenway's change via v2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions