clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
427 stars 39 forks source link

Clowd installs my "command line interface" tool as not a cli tool #155

Closed JobaDiniz closed 1 year ago

JobaDiniz commented 1 year ago

I have created a tool using System.Commandline. This tool is a CLI. I'm trying to use Clowd.Squirrel to create an installer for it. Here's the github workflow:

name: release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: 7.0.x
    - name: Restore dependencies
      run: dotnet restore ./src
    - name: Build
      run: dotnet build ./src --no-restore
    #- name: Test
    #  run: dotnet test ./src --no-build --verbosity normal
    - name: Parse tag name
      shell: bash
      run: |
         REF_NAME=${{ github.ref_name }}
         VERSION=${REF_NAME#v}
         SEMVER_REGEX='^((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*))(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$'
         echo "VERSION=$VERSION" >> $GITHUB_ENV
         if [[ $VERSION =~ $SEMVER_REGEX ]]
         then
           echo "MAIN_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
           echo "PRE_RELEASE_VERSION=${BASH_REMATCH[6]}" >> $GITHUB_ENV
         else
           echo "$VERSION doesn't match"
         fi
    - name: Publish 
      run: dotnet publish ./src/Joba.IBM.RPA.Cli/Joba.IBM.RPA.Cli.csproj -f net7.0 -c Release -o ./publish -p:VersionPrefix=${MAIN_VERSION} -p:VersionSufix=${PRE_RELEASE_VERSION} --self-contained
    - name: Squirrel install
      run: dotnet tool install --global csq --version 3.0.210-g5f9f594
    - name: Squirrel pack
      run: csq --csq-version=3.0.210-g5f9f594 pack --packId rpa --packDir "./publish" --mainExe "rpa.exe" --releaseDir "./release" --packVersion "${{ env.VERSION }}"
    - name: Squirrel release
      run: csq --csq-version=3.0.210-g5f9f594 github-up --releaseDir "./release" --repoUrl "https://github.com/Joba-Diniz/ibm-rpa-cli" --token "${{secrets.CLOWD_SQUIRREL_PAT_TOKEN}}" --publish

It created a release. I downloaded the rpaSetup.exe and I had to run as admin to install (not sure why).

If I open the terminal and run rpa.exe, it does not run in the terminal. It launches ?"another"? tool... not sure what's going on.

Untitled video - Made with Clipchamp

caesay commented 1 year ago

The GIF is too small for me to read, however Squirrel does not really have support for CLI tools per say. If you review the application directory, you'll see that there will be a YourApp.exe binary in the root folder of the install. This is not your binary. This is a stub which will execute your app inside of app-1.0.0/YourApp.exe or maybe current/YourApp.exe depending on which version of Squirrel you use. I may look to improve this in the future, however as it stands it will be up to you to avoid the stub and run the correct binary if you wish it to work properly from the terminal.