-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement initial chocolatey packaging workflow #1400
base: master
Are you sure you want to change the base?
Changes from 1 commit
549f6fb
a8b8db8
1eb624d
a15e0af
c2f7a2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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> |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also provide scripts to uninstall and upgrade? (I understand this is a first implementation, shooting my ideas). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chocolatey includes an autoinstaller - I've validated this works with the msi installer/uninstaller |
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 |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we change the tools directory to .github/choco/tools? This will be consistent with |
||
|
||
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.