npm deployment provider

Kasper Bøgebjr's Avatar

Kasper Bøgebjr

10 Aug, 2016 11:47 AM

HI

I would like to deploy using multiple providers (like Github etc) one of them is npm.

  • Is there a way to deploy using the builtin providers and a custom script for npm?. I would like to use the conditionally deployment feature like on: appveyor_repo_tag: true for my custom script (or npm) as well.

  • Are there any plans for a builtin npm deployment provider?

Thanks.

Kasper

  1. 1 Posted by Ilya Finkelshte... on 10 Aug, 2016 11:51 PM

    Ilya Finkelshteyn's Avatar

    Hi Kasper,

    If I understand you correctly, you are asking for “generic” deployment provider, where you can implement your own deployment logic with script? And then to be able to conditionally deploy using this or other deployment providers and this would look like this in YAML:

    deploy:
    - provider: FTP
      host: ftp.foo.bar
      protocol: ftp
      username: user1
      password:
        secure: blabla
      on:
        myCondition: false
    
    - provider: CustomScript
      scriptBody: Write-host "custom deployment"
      on:
        myCondition: true
    

    We have this request https://github.com/appveyor/ci/issues/128. Unfortunately, it is not implemented still but we are seriously considering to do it, though I cannot say ETA right now.

    For now the only what you can do with conditional script deployment is this (which eliminates other providers)

    deploy_script:
    - ps: if ($myCondition) {Write-host "Custom deployment"}
    

    What about npm provider, we think that generic script based provider is higher priority and having generic provider will fix luck of specific npm provider.

    Thank you,
    Ilya.

  2. 2 Posted by Kasper Bøgebjer... on 11 Aug, 2016 06:29 AM

    Kasper Bøgebjerg's Avatar

    Thanks for your quick reply.

    The issue with the deploy script is naturally that it eliminates the other providers, which means I need to implement the ones I need in my script. Is there a way for me to run the providers from a script ?

    But thanks I'll watch that issue on Github.

    Regrading npm, I would rather have a built-in npm provider than a script provider, but I understand why you would priorities differently.

    Thanks.

  3. 3 Posted by Ilya Finkelshte... on 11 Aug, 2016 07:07 PM

    Ilya Finkelshteyn's Avatar

    Hi Kasper,

    Indeed you can run different providers from script, side by side with custom script, using Environments REST API (https://www.appveyor.com/docs/api/environments-deployments#start-deployment). Sorry for not proposing this from the beginning…

    This can be added as a deployment script to achieve your goal (assumption is that you already created and tested deployment environment(s)):

    if ($env:appveyor_repo_tag -eq $true){
        $token = <your_api_token> #you use secure variable here
        $headers = @{
          "Authorization" = "Bearer $token"
          "Content-type" = "application/json"
        }

        $body = @{
            environmentName=<your_environment_name>
            accountName=<your_account_name>
            projectSlug=<your_project_slug>
            buildVersion=$env:APPVEYOR_BUILD_VERSION
        }

        $body = $body | ConvertTo-Json

        Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/deployments' -Headers $headers -Body $body -Method POST
    }
    else{
        Write-Host "Deployment when no tag set"
    }

    Thank you,
    Ilya.

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:07 AM.

Comments are currently closed for this discussion. You can start a new one.

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