Powershell script that adds .nupkgs
to your Nuget Feed based on a git
repo as well as pulling from Chocolatey.org. Detects any changes, if so - run choco pack
against the package. For external packages via Chocolatey.org, it will download the latest available, including Beta packages listed primarily.
- Windows Server - The following
IIS
features will be required:NetFx3 NetFx3ServerFeatures NetFx4Extended-ASPNET45 IIS-WebServerRole IIS-WebServer IIS-CommonHttpFeatures IIS-Security IIS-RequestFiltering IIS-StaticContent IIS-DefaultDocument IIS-DirectoryBrowsing IIS-HttpErrors IIS-ApplicationDevelopment IIS-NetFxExtensibility45 IIS-ISAPIExtensions IIS-ISAPIFilter IIS-ASPNET45 IIS-HealthAndDiagnostics IIS-HttpLogging IIS-BasicAuthentication IIS-WindowsAuthentication IIS-Performance IIS-HttpCompressionStatic IIS-WebServerManagementTools IIS-ManagementConsole
- .Net 4.6.2 - Install before enabling Nuget.
- Nuget.Server - Nuget will host the feed in order to provide packages to your clients.
- Powershell 5 or above.
-
Install a version of Windows Server.
- Add the
IIS
role along with the features listed in prerequisites. - Ensure
.Net 4.6.2
and above is installed.
- Add the
-
Head over to NugetServer.net and select which you would like. I preffered the free version in which has you use Visual Studio to create the empty web app.
-
Once the
Nuget
server has been setup and is live, pull down this repo and save the script where you'd like. -
Install Chocolatey for use of tools.
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
-
Change the variables in the top section of this script based on location of Nuget Server and
git
repo.$destination = 'C:\nugetfeeds\MyFirstFeed\Packages' $git_bin = "$env:ProgramFiles\Git\bin\git.exe" $repo_url = 'https://github.com/chocolatey/chocolatey-coreteampackages.git' $repo_dir = ($repo_url.Split('/')[-1]).Replace('.git','') $repo = "C:\repo-choco-autopkgr\$($repo_dir)"
-
Here's the fun part. You can either run this script manually where it stands, OR setup a
Scheduled Task
to run it every so often based on your needs.- Just want the external packages?
.\repo-choco-autopkgr.ps1 -Chocolatey
- Just the
git
repo?.\repo-choco-autopkgr.ps1 -Git
- Or you want both.
.\repo-choco-autopkgr.ps1 -Git -Chocolatey
- Just want the external packages?
-
Once the
.nupkg
's start hitting your feed, Nuget Server will create folders for each one and cache the items in order for them to appear. Run aclist
against your server to verify.
- Add support for
hg
- Setup
IIS
- Setup
Nuget Server
- Setup
Chocolatey
- Basically an All-In-One
Feel free to open an issue or submit a pull request.