PS Script before build

mark.garcia's Avatar

mark.garcia

19 Aug, 2019 07:11 AM

I am trying to run this script without creating a yml file. How come the script is being called as one command instead of one line at a time?

  1. 1 Posted by mark.garcia on 19 Aug, 2019 07:18 AM

    mark.garcia's Avatar

    This is what happened

  2. Support Staff 2 Posted by Owen McDonnell on 19 Aug, 2019 04:34 PM

    Owen McDonnell's Avatar

    Can you go to the project's Export YAML tab and download the config file it produces and post it here.

  3. 3 Posted by mark.garcia on 19 Aug, 2019 11:06 PM

    mark.garcia's Avatar

    version: 1.0.{build}
    image: Visual Studio 2017
    configuration: Release
    environment:
      API_DOMAIN_NAME: https://api8.hometesterclub.com
    before_build:
    - ps: >-
        Install-Product node $Env:nodejs_version

        npm install -g npm

        npm install -g webpack

        npm install -g webpack-cli

        cd %APPVEYOR_BUILD_FOLDER%

        cd BuchananGroup.Plugin

        ((Get-Content -path .\src\services.js -Raw) -replace 'http://htc_api.local',$env:API_DOMAIN_NAME) | Set-Content -Path .\src\services.js

        npm install

        npm run build

        cd %APPVEYOR_BUILD_FOLDER%

        nuget restore
    build:
      publish_wap: true
      verbosity: minimal
    artifacts:
    - path: BuchananGroup.Plugin\dist\widget.js
      name: WidgetJs
    deploy:
    - provider: Environment
      name: HTC-Api-Beta
      on:
        branch: master

  4. Support Staff 4 Posted by Owen McDonnell on 20 Aug, 2019 01:30 PM

    Owen McDonnell's Avatar

    It's quite perplexing indeed. I can't see anything wrong except for the fact that you are using cmd variable syntax %APPVEYOR_BUILD_FOLDER% for powershell (should use $env:APPVEYOR_BUILD_FOLDER) but that doesn't seem to be the problem here.

    Can you try to remove all but the first few commands and run a build.
    Also, if this is blocking you, I'm guessing that checking in an appveyor.yml file with the above config in it would not run into this error. Though, of course, we'd still like to find out why this error is occurring.

  5. 5 Posted by mark.garcia on 20 Aug, 2019 03:49 PM

    mark.garcia's Avatar

    Removing all the script would successfully build and I think adding them into an appveyor.yml file would also work but I am trying to avoid adding a yml because I need to push to git everytime I want to try something in the build process.

  6. Support Staff 6 Posted by Owen McDonnell on 20 Aug, 2019 09:16 PM

    Owen McDonnell's Avatar

    Would you be able to add me ([email blocked]) as a collaborator with build permissions to this project so that i could investigate further?

  7. 7 Posted by mark.garcia on 21 Aug, 2019 05:56 AM

    mark.garcia's Avatar

    I don't think it will be allowed. I think I'll just use the appveyor file. Will let you know if it works.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • edit1.png 19.5 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac