This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: GuessWhoSamFoo <sfoohei@gmail.com>
- Loading branch information
1 parent
fe70e8a
commit 6585d3c
Showing
8 changed files
with
170 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.js text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
*.dll | ||
*.so | ||
*.dylib | ||
*.nupkg | ||
*.bak | ||
|
||
rice-box.go | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Chocolatey Packages | ||
|
||
This directory contains chocolatey packages that can be pushed to the public registry in the future. CI steps will build a NuGet package from the an existing `*.nuspec` file then install locally using chocolatey for testing. | ||
|
||
Eventually this should be move to a separate repository to track multiple chocolately packages. | ||
|
||
## Requirements | ||
|
||
chocolatey0.10.11 | ||
|
||
## 1. Scaffold a new package | ||
|
||
This generates a new directory containing a `*.nuspec` file and PowerShell scripts for install/uninstall. | ||
|
||
``` | ||
choco new <package-name> | ||
``` | ||
|
||
Refer to the documentation for flags to prefill metadata. | ||
|
||
## 2. Edit package metadata | ||
|
||
The `*.nuspec` file contains information about the package maintainers, project website, licenses, etc. Instructions are commented out within the file and remove them as fields are completed. | ||
|
||
Inside the tools directory, there is a PowerShell installer script. Edit the URL to the location of the `*.exe` or `*.zip`. | ||
|
||
## 3. Build the package | ||
|
||
Generate a NuGet package with the `*.nupkg` extension from the `*.nuspec` file. | ||
|
||
``` | ||
choco pack <name>.nuspec | ||
``` | ||
|
||
## 4. Push the package to a chocolatey server | ||
|
||
Adding a package to `chocolatey` will require an account with an API key. Chocolatey will also undergo an additional review of the package before it is publically available. | ||
|
||
``` | ||
choco push <name>.nupkg --apikey="<key>" --source="http://localhost/chocolatey" | ||
``` | ||
|
||
## (Optional) Add a chocolatey server | ||
|
||
``` | ||
choco source add --name=<name> --source="http://localhost/chocolatey" | ||
``` | ||
|
||
## Resources | ||
|
||
[Setting up a testing environment with Vagrant](https://github.com/chocolatey/chocolatey-test-environment) | ||
[Workshop and exercises](https://github.com/ferventcoder/chocolatey-workshop) | ||
[Automatic package updates](https://github.com/majkinetor/au) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>hcli</id> | ||
<version>0.1.1</version> | ||
<owners>Heptio</owners> | ||
<title>hcli</title> | ||
<authors>Sam Foo</authors> | ||
<projectUrl>https://github.com/heptio/developer-dash</projectUrl> | ||
<licenseUrl>https://github.com/heptio/developer-dash/blob/master/LICENSE</licenseUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<tags>hcli kubernetes chocolatey kubectl heptio dashboard</tags> | ||
<summary>Kubernetes dashboard for viewing workloads</summary> | ||
<description>A Kubernetes dashboard for developers | Install with chocolatey (https://nuget.org/List/Packages/chocolatey).</description> | ||
</metadata> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
$ErrorActionPreference = 'Stop'; | ||
$packageName = 'hcli' | ||
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
$url64 = 'https://github.com/heptio/developer-dash/releases/download/v0.1.1/hcli_0.1.1_Windows-64bit.zip' | ||
$checksum64 = '9150f16fe49834ebd3ad065ac5a77acd506cd6ec5232fbe3b2fa191588670a47' | ||
$checksumType64= 'sha256' | ||
|
||
$packageArgs = @{ | ||
packageName = $packageName | ||
unzipLocation = $toolsDir | ||
url64bit = $url64 | ||
|
||
softwareName = 'hcli*' | ||
|
||
checksum64 = $checksum64 | ||
checksumType64= 'sha256' | ||
} | ||
|
||
Install-ChocolateyZipPackage @packageArgs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This script requires a Github token with repo scope | ||
# It is used to update the chocolately package version | ||
|
||
BASE_URL="https://api.github.com/repos/heptio/developer-dash/releases" | ||
GITHUB_URL="https://github.com/heptio/developer-dash/releases" | ||
|
||
semver=$(make version) | ||
version=$(echo $semver | cut -c2-) | ||
|
||
echo "Latest version is ${semver}" >&2 | ||
|
||
# Downloading release archives from private GH repo requires an asset ID | ||
# Get asset IDs from archive | ||
name="hcli_${version}_Windows-64bit.zip" | ||
response="$BASE_URL/tags/${semver}?access_token=$GITHUB_TOKEN" | ||
eval $(curl -L $response | grep -C3 "name.:.\+$name" | grep -w id | tr : = | tr -cd '[[:alnum:]]=') | ||
[ "$id" ] || { echo "Error: Failed to get asset id, response: $response" | awk 'length($0)<100' >&2; exit 1; } | ||
|
||
download="$BASE_URL/assets/$id?access_token=$GITHUB_TOKEN" | ||
checksum64=$(curl --fail -L -H 'Accept: application/octet-stream' "${download}" | shasum -a 256 - | cut -f 1 -d " ") | ||
|
||
url64="$GITHUB_URL/download/${semver}/$name" | ||
|
||
# If public, use this instead | ||
#url64="https://github.com/heptio/developer-dash/releases/download/$(make version)/hcli_$(make version | cut -c2-)_Windows-64bit.zip" | ||
# | ||
#checksum64=$(curl --fail -L "${url64}" | shasum -a 256 - | cut -f 1 -d " ") | ||
|
||
echo "Updating choco metadata..." >&2 | ||
sed -i.bak "s/<version>.*<\/version>/<version>${version}<\/version>/" ./choco/hcli.nuspec | ||
sed -i.bak "s!^\$url64 = '.*'!\$url64 = '${url64}'!" ./choco/tools/chocolateyinstall.ps1 | ||
sed -i.bak "s/^\$checksum64 = '.*'/\$checksum64 = '${checksum64}'/" ./choco/tools/chocolateyinstall.ps1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
if [ -z "$TRAVIS" ]; then | ||
echo "this script is intended to be run only on travis" >&2; | ||
exit 1 | ||
fi | ||
|
||
if [[ $TRAVIS_OS_NAME == 'windows' ]]; then | ||
choco pack $TRAVIS_BUILD_DIR/choco/hcli.nuspec | ||
choco install $TRAVIS_BUILD_DIR/hcli.$(make version | cut -c2- ).nupkg | ||
hcli version | ||
fi | ||
|