How to wire up a webhook using powershell after a successful web deployment?

Pure Krome's Avatar

Pure Krome

09 Oct, 2017 12:34 AM

Hi AV :)

So I'm trying to figure out how to use powershell to call a webhook when the webdeploy step was successful.

Checking the docs, it looks like I can use the deployment_success or on_success steps.

Now, these are the questions I'm not sure about:

  1. Can this only occur on a specific branch? E.g. when we do a master build/deploy?

I was thinking something like this..

      - dev


      - master

  configuration: Release  
    - provider: WebDeploy

    - ps: <something here>
  1. We're playing around with using RETRACE by STACKIFY for our code insights/metrics. They have the ability for us to 'tag' when we deploy, so we can see which code metrics are for build #1 vs build #2, etc. To do this, they have a provided API and provided a full powershell script file. Now, I'm not sure where we should put this file and how to call this file from appveyor.yml.

Lets assume it's in a folder called scripts in our ROOT github repo folder. the file is called stackify-deploy.ps1 ... how do we call it?

here's the example they give us ...

ps > .\stackify-deploy.ps1 complete -apiKey "SUN98aIxmzZUkUX8BYNsybDcxJctxEuYjHCKX9M0jo" -app \"FooApp\" -env \"Prod\" -version "v1.0" -name \"BourneAgain\" -branch "master" -commit "ca35857d2cc6050a2525491840922a6d5d359006" -uri "localhost"

of course:

  • -apikeyis a secure environment variable i'll setup
  • -version is the appveyor version variable
  • -branch is the appveyor branch variable
  • -commit is the appveyor commit variable
  • -uri ... no idea what this optional setting is. will get more info on this.

So .. if I place the .ps1 file is found at \scripts\stackfiy-deploy.ps1 ... how can I use it please?

  1. Support Staff 1 Posted by Ilya Finkelshte... on 10 Oct, 2017 10:37 PM

    Ilya Finkelshteyn's Avatar


    • Best place for you to put that script is after_deploy script

    • You do not need that complexity in yaml. just use APPVEYOR_REPO_BRANCH environment variable to condition it.

    • It can look like this:

    - ps: IF ($env:APPVEYOR_REPO_BRANCH -eq "master") {.\scripts\stackfiy-deploy.ps1 complete -apiKey $env:api_key <snipped>}

    this assumes that you do not do CD command and change current directory. Otherwise you can use more reliable path like $env:APPVEYOR_BUILD_FOLDER\scripts\stackfiy-deploy.ps1

  2. 2 Posted by Pure Krome on 10 Oct, 2017 10:43 PM

    Pure Krome's Avatar

    Thanks @Ilya! That's great stuff :)

    also, is it IF or if (all upper or all lower case) ?

  3. Support Staff 3 Posted by Ilya Finkelshte... on 10 Oct, 2017 11:16 PM

    Ilya Finkelshteyn's Avatar

    It is not case sensitive, use what you prefer :)

Reply to this discussion

Internal reply

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

Attaching KB article:


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


? 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


18 Aug, 2018 11:54 AM
18 Aug, 2018 12:13 AM
17 Aug, 2018 06:02 PM
17 Aug, 2018 04:26 PM
17 Aug, 2018 04:04 PM
17 Aug, 2018 06:31 AM