-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add Chocolatey and Homebrew packaging support (#44) #47
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f48b0eb
feat: add Chocolatey and Homebrew packaging support
jbrinkman 058817a
fix: resolve MarkdownLint violations in documentation
jbrinkman 8ad9c4c
fix: clean up whitespace in YAML and PowerShell scripts
jbrinkman 9b73cca
feat: add new icon assets for application
jbrinkman 9331ac9
fix: Address critical code review issues
jbrinkman ad1413d
fix: Add iconUrl using Statically.io CDN for icon128.png
jbrinkman 9048224
fix: Add whitespace for better readability in chocolateyuninstall.ps1
jbrinkman a69637f
fix: Refactor checksum calculation to improve readability and maintaiβ¦
jbrinkman ed7145c
fix: Add validation pattern for ChecksumX64 parameter
jbrinkman d75d81c
fix: Update checksum replacement to use regex for consistency
jbrinkman 36c73e8
fix: Enhance SHA256 validation with error message and remove duplicatβ¦
jbrinkman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,199 @@ | ||
| # Package Manager Setup Guide | ||
|
|
||
| This document explains how to set up automated publishing to Chocolatey and Homebrew package managers for DotNet API Diff releases. | ||
|
|
||
| ## Overview | ||
|
|
||
| The release workflow automatically builds and publishes packages to: | ||
|
|
||
| - **Chocolatey** (Windows package manager) | ||
| - **Homebrew** (macOS/Linux package manager) | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| ### Repository Secrets | ||
|
|
||
| The following secrets must be configured in the GitHub repository settings: | ||
|
|
||
| 1. **CHOCOLATEY_API_KEY**: API key for publishing to Chocolatey | ||
|
|
||
| ### Package Manager Accounts | ||
|
|
||
| #### Chocolatey Setup | ||
|
|
||
| 1. **Create Chocolatey Account**: | ||
| - Visit [Chocolatey Community](https://community.chocolatey.org/) | ||
| - Create an account or sign in | ||
| - Navigate to your profile and generate an API key | ||
|
|
||
| 2. **Package Registration**: | ||
| - The first package version must be manually submitted for approval | ||
| - Subsequent versions will be automatically published via the API | ||
| - Package ID: `dotnetapidiff` | ||
|
|
||
| 3. **Configure GitHub Secret**: | ||
|
|
||
| ```bash | ||
| # In GitHub repository settings > Secrets and variables > Actions | ||
| # Add new repository secret: | ||
| Name: CHOCOLATEY_API_KEY | ||
| Value: [Your Chocolatey API key] | ||
| ``` | ||
|
|
||
| #### Homebrew Setup | ||
|
|
||
| Homebrew publishing is currently handled by generating an updated formula that can be: | ||
|
|
||
| 1. **Submitted to homebrew-core** (requires community approval) | ||
| 2. **Published to a custom tap** (immediate publishing) | ||
|
|
||
| For custom tap approach: | ||
|
|
||
| 1. Create a repository named `homebrew-dotnetapidiff` | ||
| 2. The workflow generates the updated formula as an artifact | ||
| 3. Manually or automatically commit the formula to the tap repository | ||
|
|
||
| ## Workflow Details | ||
|
|
||
| ### Chocolatey Publishing | ||
|
|
||
| The workflow automatically: | ||
|
|
||
| 1. Builds Windows x64 and ARM64 binaries | ||
| 2. Calculates SHA256 checksums | ||
| 3. Creates a Chocolatey package (.nupkg) | ||
| 4. Publishes to Chocolatey Community using the API key | ||
|
|
||
| **Package Structure:** | ||
|
|
||
| ```text | ||
| dotnetapidiff/ | ||
| βββ tools/ | ||
| β βββ chocolateyinstall.ps1 # Installation script | ||
| β βββ chocolateyuninstall.ps1 # Uninstallation script | ||
| β βββ dotnetapidiff.bat # Command wrapper | ||
| βββ dotnetapidiff.nuspec # Package metadata | ||
| ``` | ||
|
|
||
| ### Homebrew Formula | ||
|
|
||
| The workflow automatically: | ||
|
|
||
| 1. Downloads all platform binaries (macOS/Linux, x64/ARM64) | ||
| 2. Calculates SHA256 checksums for each platform | ||
| 3. Generates an updated Homebrew formula with correct URLs and checksums | ||
| 4. Uploads the formula as a build artifact | ||
|
|
||
| **Formula Features:** | ||
|
|
||
| - Platform detection (macOS/Linux, Intel/ARM) | ||
| - Automatic binary selection based on platform | ||
| - SHA256 verification | ||
| - Installs binary as `dotnetapidiff` | ||
|
|
||
| ## Package Testing | ||
|
|
||
| ### Chocolatey Testing | ||
|
|
||
| ```powershell | ||
| # Install package | ||
| choco install dotnetapidiff | ||
|
|
||
| # Test installation | ||
| dotnetapidiff --version | ||
|
|
||
| # Uninstall | ||
| choco uninstall dotnetapidiff | ||
| ``` | ||
|
|
||
| ### Homebrew Testing | ||
|
|
||
| ```bash | ||
| # Install from custom tap (if using tap approach) | ||
| brew tap jbrinkman/dotnetapidiff | ||
| brew install dotnetapidiff | ||
|
|
||
| # Test installation | ||
| dotnetapidiff --version | ||
|
|
||
| # Uninstall | ||
| brew uninstall dotnetapidiff | ||
| ``` | ||
|
|
||
| ## Manual Package Creation | ||
|
|
||
| For testing or manual publishing: | ||
|
|
||
| ### Chocolatey | ||
|
|
||
| ```powershell | ||
| # Build package locally | ||
| .\scripts\build-chocolatey.ps1 -Version "1.0.0" -ChecksumX64 "abc123..." -ChecksumArm64 "def456..." | ||
|
|
||
| # Test package locally | ||
| choco install .\build\chocolatey\dotnetapidiff.1.0.0.nupkg | ||
|
|
||
| # Publish manually | ||
| .\scripts\build-chocolatey.ps1 -Version "1.0.0" -ChecksumX64 "abc123..." -ChecksumArm64 "def456..." -ApiKey "your-api-key" -Publish | ||
| ``` | ||
|
|
||
| ### Homebrew | ||
|
|
||
| ```bash | ||
| # Generate formula | ||
| ./scripts/update-homebrew.sh "1.0.0" "osx_arm64_hash" "osx_x64_hash" "linux_arm64_hash" "linux_x64_hash" | ||
|
|
||
| # Test formula (if brew is available) | ||
| brew install ./build/homebrew/dotnetapidiff.rb | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| 1. **Chocolatey API Key Invalid**: | ||
| - Verify the API key in repository secrets | ||
| - Check if the key has expired or been revoked | ||
|
|
||
| 2. **Package Approval Required**: | ||
| - First-time packages on Chocolatey require manual approval | ||
| - Check the package status on Chocolatey Community | ||
|
|
||
| 3. **Checksum Mismatch**: | ||
| - Ensure release assets are fully uploaded before package creation | ||
| - Verify download URLs are accessible | ||
|
|
||
| 4. **Homebrew Formula Validation Fails**: | ||
| - Check formula syntax using `brew audit` | ||
| - Ensure all download URLs are valid and accessible | ||
|
|
||
| ### Debugging | ||
|
|
||
| 1. **Check Workflow Logs**: | ||
| - GitHub Actions logs show detailed error messages | ||
| - Look for failed steps in package publishing jobs | ||
|
|
||
| 2. **Test Locally**: | ||
| - Run packaging scripts manually with test data | ||
| - Verify package installation on target platforms | ||
|
|
||
| 3. **Package Manager Status**: | ||
| - Check package status on Chocolatey Community | ||
| - Verify formula syntax and platform support | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| 1. **API Key Management**: | ||
| - Store API keys only in GitHub repository secrets | ||
| - Regularly rotate API keys | ||
| - Limit API key permissions to package publishing only | ||
|
|
||
| 2. **Package Integrity**: | ||
| - All packages include SHA256 checksums | ||
| - Binaries are built from tagged releases only | ||
| - Package contents are validated during build | ||
|
|
||
| 3. **Automated Publishing**: | ||
| - Only triggered on tagged releases (v*.*) | ||
| - Requires successful build and test completion | ||
| - Includes rollback strategies for failed publications |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.