-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement initial chocolatey packaging workflow
Signed-off-by: mikeee <[email protected]>
- Loading branch information
Showing
4 changed files
with
123 additions
and
0 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,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>dapr</id> | ||
<version>dapr_cli_version</version> | ||
<packageSourceUrl>https://github.com/dapr/cli/tree/master/.github/scripts/chocolatey</packageSourceUrl> | ||
<owners>mikeee, dapr</owners> | ||
<title>Dapr CLI (Install)</title> | ||
<authors>The Dapr Authors</authors> | ||
<projectUrl>https://dapr.io/</projectUrl> | ||
<iconUrl>https://cdn.jsdelivr.net/gh/dapr/website/static/images/dapr.svg</iconUrl> | ||
<copyright>Copyright 2021 The Dapr Authors</copyright> | ||
<licenseUrl>https://github.com/dapr/cli/blob/master/LICENSE</licenseUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<projectSourceUrl>https://github.com/dapr/cli</projectSourceUrl> | ||
<docsUrl>https://docs.dapr.io/reference/cli/cli-overview/</docsUrl> | ||
<bugTrackerUrl>https://github.com/dapr/cli/issues</bugTrackerUrl> | ||
<tags>dapr distributed application runtime cli kubernetes</tags> | ||
<summary>The Dapr CLI is the main tool for running Dapr-related tasks</summary> | ||
<description> | ||
The Dapr CLI allows you to setup Dapr on your local dev machine or on a Kubernetes cluster, provides debugging support, and launches and manages Dapr instances. | ||
|
||
Dapr is a set of integrated APIs with built-in best practices and patterns to build distributed applications. Dapr increases your developer productivity by 20-40% with out-of-the-box features such as workflow, pub/sub, state management, secret stores, external configuration, bindings, actors, distributed lock, and cryptography. You benefit from the built-in security, reliability, and observability capabilities, so you don't need to write boilerplate code to achieve production-ready applications. | ||
</description> | ||
<releaseNotes>https://github.com/dapr/cli/releases</releaseNotes> | ||
</metadata> | ||
<files> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</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,16 @@ | ||
$root = Join-Path "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" "install" | ||
$packageArgs = @{ | ||
packageName = $env:ChocolateyPackageName | ||
unzipLocation = $root | ||
fileType = 'msi' | ||
url64 = 'dapr_cli_url' | ||
checksum64 = 'dapr_cli_checksum' | ||
checksumType64= 'SHA256' | ||
|
||
silentArgs = '/qn /norestart' | ||
validExitCodes= @(0, 1641, 3010) | ||
|
||
} | ||
|
||
New-Item -ItemType Directory -Force -Path $root | Out-Null | ||
Install-ChocolateyPackage @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
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,65 @@ | ||
name: release_chocolatey | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
daprcli_version: | ||
type: string | ||
description: "The Dapr CLI version to package (example: 1.13.0 or 1.13.0-rc1)" | ||
required: true | ||
workflow_dispatch: | ||
inputs: | ||
daprcli_version: | ||
description: "The Dapr CLI version to package (example: 1.13.0 or 1.13.0-rc1)" | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: windows-latest | ||
env: | ||
DAPR_CLI_VERSION: ${{ github.event.inputs.daprcli_version }} | ||
defaults: | ||
run: | ||
working-directory: .github/scripts/chocolatey/ | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
|
||
# Get checksum file | ||
- name: Get checksum file | ||
shell: pwsh | ||
run: Invoke-WebRequest https://github.com/dapr/cli/releases/download/v1.13.0/dapr.msi.sha256 -OutFile dapr.msi.sha256 | ||
|
||
# Parse SHA256 from file | ||
- name: Parse SHA256 from file and write to $SHA256SUM | ||
shell: pwsh | ||
run: | | ||
$Env:SHA256SUM = (Get-Content dapr.msi.sha256 | foreach{$_.replace(" *dapr.msi", "")} | Set-Content -Path dapr.msi.sha256 | ||
echo "SHA256SUM=$env:SHA256SUM" >> $env:GITHUB_ENV | ||
# Update script url | ||
- name: Update install script url | ||
shell: pwsh | ||
run: Get-Content tools/chocolateyInstall.ps1 | foreach{$_.replace("dapr_cli_url", "https://github.com/dapr/cli/releases/download/v$env:DAPR_CLI_VERSION/dapr.msi")} | Set-Content -Path tools/chocolateyInstall.ps1 | ||
|
||
# Update script hash | ||
- name: Update install script hash | ||
shell: pwsh | ||
run: Get-Content tools/chocolateyInstall.ps1 | foreach{$_.replace("dapr_cli_checksum", "$env:SHA256SUM")} | Set-Content -Path tools/chocolateyInstall.ps1 | ||
|
||
# Update manifest version | ||
- name: Update manifest version | ||
shell: pwsh | ||
run: Get-Content dapr.nuspec | foreach{$_.replace("dapr_cli_version", "$env:DAPR_CLI_VERSION")} | Set-Content -Path dapr.nuspec | ||
|
||
# Use chocolatey to compile the repository into a nupkg | ||
- name: Compile package | ||
shell: pwsh | ||
run: choco pack | ||
|
||
# Publish package to the respository 'choco push' | ||
- name: Publish package to the community respository | ||
shell: pwsh | ||
env: | ||
CHOCOLATEY_TOKEN: ${{ secrets.CHOCOLATEY_TOKEN }} | ||
run: choco push -k $env:CHOCOLATEY_TOKEN |