upload-release-action icon indicating copy to clipboard operation
upload-release-action copied to clipboard

Can't get file_glob to work

Open ba32107 opened this issue 3 years ago • 16 comments

Hi!

Thanks a lot for this action, it's very useful. I'm not sure if this is a bug or I'm doing something wrong.

Here's (part of) my workflow:

build-appimage-linux:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2
    - name: Build AppImage
      run: ./packaging/linux/build_appimage.sh
    - name: Upload AppImage to Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: ./dist/*.AppImage
        file_glob: true
        overwrite: true
        tag: ${{ github.ref }}
build-windows-packages:
    runs-on: windows-2019
    steps:
    - uses: actions/checkout@v2
    - name: Build packages
      run: ./build.bat --package
    - name: Upload installer to Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: dist\*.msi
        file_glob: true  
        overwrite: true
        tag: ${{ github.ref }}
    - name: Upload portable package to Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: dist\*.zip
        file_glob: true  
        overwrite: true
        tag: ${{ github.ref }}

I have two jobs, one for Windows, the other for Linux. However file_glob doesn't work for either:

1s
Run svenstaro/upload-release-action@v2
  with:
    repo_token: ***
    file: ./dist/*.AppImage
    file_glob: true
    overwrite: true
    tag: refs/tags/vsdfkllsdkfgf_companion
Error: No files matching the glob pattern found.

Run svenstaro/upload-release-action@v2
  with:
    repo_token: ***
    file: dist\*.msi
    file_glob: true
    overwrite: true
    tag: refs/tags/vsdfkllsdkfgf_companion
Error: No files matching the glob pattern found.

The working directory is definitely set correctly (because the build script themselves can be found), and the dist directory definitely exists. What am I doing wrong?

My current workaround is to use full paths, which does work:

  build-appimage-linux:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2
    - name: Build AppImage
      run: |
        source ./packaging/linux/build_appimage.sh
        echo "APPIMAGE_FULL_PATH=$_APPIMAGE_FILENAME" >> $GITHUB_ENV
    - name: Upload AppImage to Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: ${{ env.APPIMAGE_FULL_PATH }}
        overwrite: true
        tag: ${{ github.ref }}
 build-windows-packages:
    runs-on: windows-2019
    steps:
    - uses: actions/checkout@v2
    - name: Build packages
      run: |
        ./build.bat --package
        $WIN_INSTALLER_FULL_PATH = (Get-ChildItem -Path dist -Filter "*.msi").Fullname
        $WIN_PORTABLE_FULL_PATH = (Get-ChildItem -Path dist -Filter "*.zip").Fullname
        echo "WIN_INSTALLER_FULL_PATH=$WIN_INSTALLER_FULL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "WIN_PORTABLE_FULL_PATH=$WIN_PORTABLE_FULL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
    - name: Upload installer to Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: ${{ env.WIN_INSTALLER_FULL_PATH }}
        overwrite: true
        tag: ${{ github.ref }}
    - name: Upload portable package to Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: ${{ env.WIN_PORTABLE_FULL_PATH }}
        overwrite: true
        tag: ${{ github.ref }}

ba32107 avatar Oct 18 '20 06:10 ba32107

I think you don't have to escape the asterisk.

retorquere avatar Nov 29 '20 20:11 retorquere

That is not an escape. For example, with file: dist\*.msi I want to match any .msi file in the dist directory. Similarly, with file: ./dist/*.AppImage I am looking for .AppImage files in dist.

ba32107 avatar Nov 29 '20 21:11 ba32107

@svenstaro, do you have any input on this issue please?

ba32107 avatar Nov 29 '20 21:11 ba32107

@ba32107 did you find a solution? I am encountering the same problem...

I have folder artifcats which stores my builds. This is proved by running

ls artifacts/

which results in

DaKanji_android_arm64-v7a.zip
DaKanji_android_arm64-v8a.zip
DaKanji_android_bundle.zip
DaKanji_android_x86_64.zip
DaKanji_win.msix
DaKanji_win.zip

However, when I use

- name: Upload to github releases
  uses: svenstaro/upload-release-action@v2
  with:
    repo_token: ${{ secrets.GITHUB_TOKEN }}
    file: artifacts/DaKanji_*
    file_glob: true
    tag: beta
    prerelease: true
    overwrite: true
    body: |
      IMPORTANT: this is a pre-release, you should expect some bugs 

nothing gets uploaded to my release section, only the release with the body gets created.

CaptainDario avatar Mar 24 '22 15:03 CaptainDario

The image ships with a pre-authenticated gh cli. Just use that in a run step.

retorquere avatar Mar 24 '22 15:03 retorquere

@retorquere thank you I will try it in the coming days

CaptainDario avatar Mar 24 '22 17:03 CaptainDario

@CaptainDario no I could not make it work, I'm using the workaround mentioned in my issue

ba32107 avatar Mar 24 '22 17:03 ba32107

@ba32107 I ended up using the github cli, much smoother experience and more importantly it works.

@retorquere Thanks a lot for the github cli tip, works like a charm after trying for hours to get this workflow working!

CaptainDario avatar Mar 27 '22 16:03 CaptainDario

this https://github.com/FreeCAD/FreeCAD-Bundle/blob/5720f1fca062579e198554629981f255ea9e3f45/.github/workflows/freecad_bundle.yml#L153 was working last week: https://github.com/FreeCAD/FreeCAD-Bundle/actions/runs/3867023103 but it's not working now on windows: https://github.com/FreeCAD/FreeCAD-Bundle/actions/runs/3902199452

@svenstaro did the rules for file glob change with the last update?

adrianinsaval avatar Jan 17 '23 19:01 adrianinsaval

Ah yes, there's been a regression with glob v8 I think. I will push a fix to master. Could you test it directly from master before I make a release?

svenstaro avatar Jan 19 '23 10:01 svenstaro

still not working with 9093186278f7884238ac3c14cc0adaa747ad1177 https://github.com/adrianinsaval/FreeCAD-Bundle/actions/runs/3958284587/jobs/6779667276#step:17:14

adrianinsaval avatar Jan 19 '23 12:01 adrianinsaval

Damn, I'll try to take a look soon. I think it has something to do with this: https://github.com/isaacs/node-glob/issues/467

Do you perhaps have some time to work on this? I don't know when I can get to it.

svenstaro avatar Jan 19 '23 13:01 svenstaro

https://github.com/isaacs/node-glob/issues/480 also explains it a little, seems to be just a matter of using / instead of \ , I'm testing that now https://github.com/adrianinsaval/FreeCAD-Bundle/actions/runs/3958854927/jobs/6780920316

I think this manifested also due to upgrading to node16 as this may match glob ^7 to a higher version (that already had this issue) than with node12, going back to node12 is not feasible so I think it's best to move to the current version of glob and we deal with this difference downstream

adrianinsaval avatar Jan 19 '23 13:01 adrianinsaval

it was introduced here for the v7 series: https://github.com/isaacs/node-glob/commit/c663c7d21ffe64ddb5576674735c65a8551f927a so since v7.2.3

adrianinsaval avatar Jan 19 '23 14:01 adrianinsaval

Is this good for you now? Is there anything you'd suggest to change in this repo?

svenstaro avatar Jan 21 '23 10:01 svenstaro

I think it's good as is, maybe add a warning that the glob pattern has to use / even on windows

adrianinsaval avatar Jan 21 '23 21:01 adrianinsaval