Search code examples
nugetoctopus-deploy

Packaging a static website in Nuget


I have a static website I want to deploy using Ocotpus deploy. Octopus uses nuget packages for everything so I want to turn it into a nuget package so Octopus can deploy right from my nuget feeds.

Right now I'm using this as my nuspec file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>mysite</id>
    <version>1.0.0</version>
    <authors>Alpaca</authors>
    <owners>Alpaca</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>My Package description</description>
    <copyright>2017</copyright>
    <contentFiles>
        <files include="build/**" />
    </contentFiles>
  </metadata>
</package>

Should I be using ContentFiles to deploy the site or is there a better way of building a package for a static website?


Solution

  • Better is very subjective.

    If your site is in a msbuild project (static or otherwise) then plain octopack should work. Mark anything that octopack doesnt include by convention as 'Content' and it will be included.

    Documentations is here: https://octopus.com/docs/packaging-applications/nuget-packages/using-octopack#UsingOctoPack-Includingwebapplicationcontentfiles

    That same documentation alludes to using the 'files' section of nupsec and points to the nuspec documentation here: http://docs.nuget.org/docs/reference/nuspec-reference

    We are using the nuspec files section to pack up all our common styles, ect:

      <files>
        <file src="**\*.*" target="" exclude="obj\*;bin\*;**\*.csproj;**\*.config;**\*.nuspec;**\*.less;**\*.json;grunfile.js"/>
      </files>