fix: add source parameter to choco push command for package publishing #12
Workflow file for this run
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| win_x64_sha256: ${{ steps.checksums.outputs.win_x64_sha256 }} | |
| win_arm64_sha256: ${{ steps.checksums.outputs.win_arm64_sha256 }} | |
| linux_x64_sha256: ${{ steps.checksums.outputs.linux_x64_sha256 }} | |
| linux_arm64_sha256: ${{ steps.checksums.outputs.linux_arm64_sha256 }} | |
| osx_x64_sha256: ${{ steps.checksums.outputs.osx_x64_sha256 }} | |
| osx_arm64_sha256: ${{ steps.checksums.outputs.osx_arm64_sha256 }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore /p:Version=${GITHUB_REF#refs/tags/v} | |
| - name: Test | |
| run: dotnet test --configuration Release --no-build --verbosity normal | |
| - name: Publish | |
| run: | | |
| # x64 builds | |
| dotnet publish src/DotNetApiDiff/DotNetApiDiff.csproj --configuration Release --output ./publish/win-x64 --runtime win-x64 --self-contained true -p:PublishSingleFile=true -p:Version=${GITHUB_REF#refs/tags/v} | |
| dotnet publish src/DotNetApiDiff/DotNetApiDiff.csproj --configuration Release --output ./publish/linux-x64 --runtime linux-x64 --self-contained true -p:PublishSingleFile=true -p:Version=${GITHUB_REF#refs/tags/v} | |
| dotnet publish src/DotNetApiDiff/DotNetApiDiff.csproj --configuration Release --output ./publish/osx-x64 --runtime osx-x64 --self-contained true -p:PublishSingleFile=true -p:Version=${GITHUB_REF#refs/tags/v} | |
| # ARM64 builds | |
| dotnet publish src/DotNetApiDiff/DotNetApiDiff.csproj --configuration Release --output ./publish/win-arm64 --runtime win-arm64 --self-contained true -p:PublishSingleFile=true -p:Version=${GITHUB_REF#refs/tags/v} | |
| dotnet publish src/DotNetApiDiff/DotNetApiDiff.csproj --configuration Release --output ./publish/linux-arm64 --runtime linux-arm64 --self-contained true -p:PublishSingleFile=true -p:Version=${GITHUB_REF#refs/tags/v} | |
| dotnet publish src/DotNetApiDiff/DotNetApiDiff.csproj --configuration Release --output ./publish/osx-arm64 --runtime osx-arm64 --self-contained true -p:PublishSingleFile=true -p:Version=${GITHUB_REF#refs/tags/v} | |
| - name: Create ZIP archives | |
| run: | | |
| # x64 archives | |
| cd ./publish/win-x64 && zip -r ../../dotnet-api-diff-win-x64.zip . && cd ../.. | |
| cd ./publish/linux-x64 && tar -czf ../../dotnet-api-diff-linux-x64.tar.gz . && cd ../.. | |
| cd ./publish/osx-x64 && tar -czf ../../dotnet-api-diff-osx-x64.tar.gz . && cd ../.. | |
| # ARM64 archives | |
| cd ./publish/win-arm64 && zip -r ../../dotnet-api-diff-win-arm64.zip . && cd ../.. | |
| cd ./publish/linux-arm64 && tar -czf ../../dotnet-api-diff-linux-arm64.tar.gz . && cd ../.. | |
| cd ./publish/osx-arm64 && tar -czf ../../dotnet-api-diff-osx-arm64.tar.gz . && cd ../.. | |
| - name: Calculate checksums | |
| id: checksums | |
| run: | | |
| { | |
| echo "win_x64_sha256=$(sha256sum "dotnet-api-diff-win-x64.zip" | cut -d' ' -f1)" | |
| echo "win_arm64_sha256=$(sha256sum "dotnet-api-diff-win-arm64.zip" | cut -d' ' -f1)" | |
| echo "linux_x64_sha256=$(sha256sum "dotnet-api-diff-linux-x64.tar.gz" | cut -d' ' -f1)" | |
| echo "linux_arm64_sha256=$(sha256sum "dotnet-api-diff-linux-arm64.tar.gz" | cut -d' ' -f1)" | |
| echo "osx_x64_sha256=$(sha256sum "dotnet-api-diff-osx-x64.tar.gz" | cut -d' ' -f1)" | |
| echo "osx_arm64_sha256=$(sha256sum "dotnet-api-diff-osx-arm64.tar.gz" | cut -d' ' -f1)" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dotnet-api-diff-win-x64.zip | |
| dotnet-api-diff-linux-x64.tar.gz | |
| dotnet-api-diff-osx-x64.tar.gz | |
| dotnet-api-diff-win-arm64.zip | |
| dotnet-api-diff-linux-arm64.tar.gz | |
| dotnet-api-diff-osx-arm64.tar.gz | |
| generate_release_notes: true | |
| chocolatey: | |
| needs: build | |
| runs-on: windows-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PowerShell | |
| shell: pwsh | |
| run: | | |
| # Install Chocolatey CLI if not present | |
| if (-not (Get-Command choco -ErrorAction SilentlyContinue)) { | |
| Set-ExecutionPolicy Bypass -Scope Process -Force | |
| [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | |
| iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
| } | |
| - name: Build and publish Chocolatey package | |
| shell: pwsh | |
| env: | |
| CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} | |
| run: | | |
| $version = "${{ github.ref }}" -replace 'refs/tags/v', '' | |
| .\scripts\build-chocolatey.ps1 -Version "$version" -ChecksumX64 "${{ needs.build.outputs.win_x64_sha256 }}" -ChecksumArm64 "${{ needs.build.outputs.win_arm64_sha256 }}" -ApiKey "$env:CHOCOLATEY_API_KEY" -Publish | |
| homebrew: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get release version | |
| id: release_info | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Update Homebrew formula | |
| run: | | |
| ./scripts/update-homebrew.sh "${{ steps.release_info.outputs.version }}" "${{ needs.build.outputs.osx_arm64_sha256 }}" "${{ needs.build.outputs.osx_x64_sha256 }}" "${{ needs.build.outputs.linux_arm64_sha256 }}" "${{ needs.build.outputs.linux_x64_sha256 }}" | |
| - name: Upload Homebrew formula as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: homebrew-formula | |
| path: artifacts/dotnetapidiff.rb |