简体   繁体   中英

With @electron-forge/maker-squirrel, how do I print the path of the generated installer, so that I can set a variable in an Azure Pipeline?

I am setting up an Azure DevOps Pipeline for an electron-forge project on windows.

I have a Squirrel.Windows maker which creates the installer:

      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "MyApplication",
          }
        }
      ]

I want my pipeline to pick up this path, so I can use it in eg a PublishPipelineArtifact@1 task.

I figure I can do this by using an azure logging command to print something like

##vso[task.setvariable variable=squirrel;isoutput=true]${INSTALLER_FULL_PATH}

How can I get squirrel to print out that string to stdout? Is there a better approach to this problem with Azure DevOps?

My current solution is a hack which still hardcodes some things like the output path, but I think it should work for the most part:

steps:
  - powershell: |
     $ci_package_json = Get-Content .\package.json | Out-String | ConvertFrom-Json
     Write-Host "##vso[task.setvariable variable=squirrelOutput]$(pwd)\out\make\squirrel.windows\x64\$($ci_package_json.productName)-$($ci_package_json.version) Setup.exe"
  - script: echo $(squirrelOutput)

Would love a more robust solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM