nathanwoulfe / NestingContently

A property editor for disabling Nested Content items and Block elements in Umbraco
9 stars 8 forks source link

Move UmbPack push to build script #26

Closed ronaldbarendse closed 4 years ago

ronaldbarendse commented 4 years ago

Although the current setup works, I would recommend moving the umbpack push command from the project file to the appvevor.yml build script: https://github.com/nathanwoulfe/NestingContently/blob/a7f3eedcdf76dee7668740f77d188dd77b1cbbcf/NestingContently.Umbraco/NestingContently.Umbraco.csproj#L22

AppVeyor doesn't support a custom script deployment provider, so the after_build (always run) or after_deploy (only run when deployments are triggered, so currently only on tags) can be used instead.

The artifact for the Umbraco package would need to be retrieved from the $artifacts hash table. This can be done by giving a single artifact a name or getting the right one by iterating the hashtable.

I'm not very familiar with AppVeyor, but something like this should work and only upload the ' main' Umbraco package (not the ValueConverters one):

after_deploy:
  - ps: |
      if ($env:APPVEYOR_REPO_TAG -eq "true") {
        foreach ($artifactName in $artifacts.keys) {
          $path = $artifacts[$artifactName].path
          if ($path -match "Nesting_Contently_[0-9.]+\.zip$") {
            umbpack push $path -k $env:UmbPackKey -a current
          }
        }
      }

Note that I also included the conditional statement to ensure only tagged builds are deployed/pushed, so this keeps working correctly if new deployment providers without this condition are added.