Cannot deploy to s3 - Unknown option --file

I cannot get deploy to upload single file to s3… It throws an error:
Unkown option --file "release.exe" for windows,
and Unknown option --file for Mac.
This is part of my yaml:

before_deploy:
  if ["$TRAVIS_OS_NAME" = "osx"]; then
    export FILE_TO_DEPLOY=$(ls dist/*.dmg);
  else
    export FILE_TO_DEPLOY=$(ls dist/*.exe);
  fi

deploy:
  provider: s3
  edge: true
  # Below 3 values are configured as environmental variables in Travis web console
  access_key_id: $ARTIFACTS_KEY
  secret_access_key: $ARTIFACTS_SECRET
  bucket: $ARTIFACTS_BUCKET
  region: us-west-1
  # Prevent Travis from deleting build directory
  skip_cleanup: true
  acl: public_read
  file_glob: true
  file: "dist\${FILE_TO_DEPLOY}"
  on:
    all_branches: true

Part of my logs:

travis_fold:start:before_deploy
e[0Ktravis_time:start:0011e344
e[0K$ pwd; ls; echo $TRAVIS_OS_NAME; if ["$TRAVIS_OS_NAME" = "osx"]; then export FILE_TO_DEPLOY=$(ls dist/*.dmg); else export FILE_TO_DEPLOY=$(ls dist/*.exe); fi
/c/Users/travis/build/intacct-thyme/thyme-tracker
CHANGELOG.MD
Icon.png
IconTemplate.png
IconTemplate@2x.png
README.md
app.icns
app.ico
background.png
build
codesign.sh
config-overrides.js
dist
electron-builder.env
electron-builder.json
index.js
node_modules
package.json
public
src
test
yarn.lock
windows
travis_time:end:0011e344:start=1574343707505420300,finish=1574343707617374300,duration=111954000,event=after_success
e[0Ktravis_fold:end:before_deploy
e[0Ktravis_fold:start:dpl_0
e[0K$ ruby -S gem uninstall -aIx dpl
/c/Users/travis/.travis/functions: line 109: [windows: command not found
Gem 'dpl' is not installed
travis_time:start:20a10386
e[0K$ ruby -S gem install dpl --pre
Successfully installed regstry-1.0.14
Successfully installed cl-1.1.5
Successfully installed dpl-2.0.0.alpha.11
Parsing documentation for regstry-1.0.14
Installing ri documentation for regstry-1.0.14
Parsing documentation for cl-1.1.5
Installing ri documentation for cl-1.1.5
Parsing documentation for dpl-2.0.0.alpha.11
Installing ri documentation for dpl-2.0.0.alpha.11
Done installing documentation for regstry, cl, dpl after 2 seconds
3 gems installed
travis_time:end:20a10386:start=1574343708637448200,finish=1574343714940022600,duration=6302574400,event=after_success
e[0Ktravis_fold:end:dpl_0
e[0Ktravis_time:start:07e91214
e[0Kfailed to deploy
e[31mUnknown option: --file Tracker Setup 1.0.1.exee[0m


No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received

The build has been terminated

Hello, there.

Two things.

  1. You have a syntax error in your if condition. It should be:

    before_deploy:
      if [ "$TRAVIS_OS_NAME" = "osx" ]; then
        export FILE_TO_DEPLOY=$(ls dist/*.dmg);
      else
        export FILE_TO_DEPLOY=$(ls dist/*.exe);
      fi
    

    Note the space after [ and another before ].

  2. You are using v2 for deployment, so please consult https://docs.travis-ci.com/user/deployment-v2/providers/s3/#known-options for valid options.

In general, the S3 provider is designed to upload all the files in the repository. If this is not what you want, you should put everything you want to upload into one place, and use the local_dir option.

Thanks.

Thank you @BanzaiMan,
I fixed that syntax error right away, but I got the same error, probably the FILE_TO_DEPLOY gets the wrong value or sth. Anyway, i switched to artifacts, but what is uploaded is the whole directory path that contains the file specified. I switched to electron-builder for publishing to s3 and it does exactly what i want; uploads the installers only.

Imprint