meeDamian / github-release

Github Action to create, update, or add files to Github Releases
MIT License
65 stars 35 forks source link

Spaces in file names cases upload step to not work. #33

Open wildone opened 2 years ago

wildone commented 2 years ago

Spaces in file names cases upload step to not work.

Config like this

      - name: Release files - Ubuntu
        if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
        uses: meeDamian/github-release@2.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          gzip: false
          files: >
            dist_electron/*.AppImage
            dist_electron/*.snap
            dist_electron/latest*.yml

With files like this


  total 261284
-rwxr-xr-x 1 runner docker 144196185 Mar 22 15:10 Product Name-2022.2.22.AppImage
-rw-r--r-- 1 runner docker       785 Mar 22 15:11 builder-debug.yml
-rw-r--r-- 1 runner docker       388 Mar 22 15:11 latest-linux.yml
drwxr-xr-x 5 runner docker      4096 Mar 22 15:09 linux-unpacked
-rw-r--r-- 1 runner docker 123338752 Mar 22 15:11 template-electron-vuex-vuetify_2022.2.22_amd64.snap

Generate error like this

Upload Assets
  tar: dist_electron/Product: No such file or directory
  tar: error exit delayed from previous errors
ivan-the-terrible commented 9 months ago

So after investigating this, it seems to be "a feature, not a bug" with SH (/bin/sh).

On the entrypoint.sh script, the files are evaluated within a loop: for entry in $INPUT_FILES; do

This has the unfortunate outcome of splitting strings via spaces, BUT you can change the way it should split by updating the Internal Field Separator. So the solution is:

IFS='
' && for entry in $INPUT_FILES; do

Here's a POC @meeDamian

image

I have this PR (https://github.com/meeDamian/github-release/pull/36), but it looks like this action isn't actively maintained...