Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .github/workflows/homebrew-releaser.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,71 @@ jobs:

- name: Push to NuGet
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

winget:
needs: [check, release]
if: needs.check.outputs.should-release == 'true'
runs-on: windows-latest
steps:
- uses: vedantmgoyal9/winget-releaser@v2
with:
identifier: PiersSinclair.CardPool
installers-regex: 'cpool-win-(x64|arm64)\.zip$'
release-tag: ${{ needs.check.outputs.tag }}
token: ${{ secrets.WINGET_TOKEN }}

homebrew:
needs: [check, release]
if: needs.check.outputs.should-release == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout cardpool
uses: actions/checkout@v6
with:
path: cardpool

- name: Checkout tap
uses: actions/checkout@v6
with:
repository: piers-sinclair/homebrew-cpool
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: tap

- name: Sync formula and update hashes
env:
VERSION: ${{ needs.check.outputs.version }}
TAG: ${{ needs.check.outputs.tag }}
run: |
set -euo pipefail
BASE="https://github.com/piers-sinclair/cardpool/releases/download/${TAG}"

get_sha256() { curl -fsSL "$1" | sha256sum | awk '{print $1}'; }

SHA_OSX_ARM64=$(get_sha256 "${BASE}/cpool-osx-arm64.zip")
SHA_OSX_X64=$( get_sha256 "${BASE}/cpool-osx-x64.zip")
SHA_LINUX_X64=$(get_sha256 "${BASE}/cpool-linux-x64.zip")

cp cardpool/packaging/homebrew/cpool.rb tap/Formula/cpool.rb

sed -i "s/version \"[0-9.]*\"/version \"${VERSION}\"/" tap/Formula/cpool.rb

awk \
-v osx_arm64="${SHA_OSX_ARM64}" \
-v osx_x64="${SHA_OSX_X64}" \
-v linux_x64="${SHA_LINUX_X64}" '
/cpool-osx-arm64\.zip/ { print; getline; sub(/sha256 "[0-9a-f]+"/, "sha256 \"" osx_arm64 "\""); print; next }
/cpool-osx-x64\.zip/ { print; getline; sub(/sha256 "[0-9a-f]+"/, "sha256 \"" osx_x64 "\""); print; next }
/cpool-linux-x64\.zip/ { print; getline; sub(/sha256 "[0-9a-f]+"/, "sha256 \"" linux_x64 "\""); print; next }
{ print }
' tap/Formula/cpool.rb > tap/Formula/cpool.rb.tmp
mv tap/Formula/cpool.rb.tmp tap/Formula/cpool.rb

- name: Commit and push
env:
TAG: ${{ needs.check.outputs.tag }}
run: |
git -C tap config user.name "github-actions[bot]"
git -C tap config user.email "github-actions[bot]@users.noreply.github.com"
git -C tap add Formula/cpool.rb
git -C tap commit -m "cpool ${TAG}"
git -C tap push
2 changes: 1 addition & 1 deletion .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Package Manager Smoke Test

on:
workflow_run:
workflows: ["Homebrew Release"]
workflows: ["Release"]
types: [completed]
workflow_dispatch:
inputs:
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/winget-releaser.yml

This file was deleted.

10 changes: 5 additions & 5 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Merging a version bump triggers `release.yml`, which:
3. Creates a GitHub Release tagged `v<version>` with the binaries attached
4. Pushes the NuGet package to nuget.org

Once the GitHub Release is published, two further workflows fire:
Once the binaries are built and the GitHub Release is created, two further jobs run in the same workflow:

- **`winget-releaser.yml`** — opens a pull request on [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) with the correct installer manifest and real SHA256 hashes. Microsoft's bot reviews and merges this within a few days, after which `winget install PiersSinclair.CardPool` works.
- **`homebrew-releaser.yml`** — copies the formula template from `packaging/homebrew/cpool.rb`, stamps in real SHA256 hashes, and pushes to the [piers-sinclair/homebrew-cpool](https://github.com/piers-sinclair/homebrew-cpool) tap. `brew install cpool` works immediately after.
- **`winget`** — opens a pull request on [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) with the correct installer manifest and real SHA256 hashes. Microsoft's bot reviews and merges this within a few days, after which `winget install PiersSinclair.CardPool` works.
- **`homebrew`** — copies the formula template from `packaging/homebrew/cpool.rb`, stamps in real SHA256 hashes, and pushes to the [piers-sinclair/homebrew-cpool](https://github.com/piers-sinclair/homebrew-cpool) tap. `brew install cpool` works immediately after.

## Post-release verification

Homebrew is verified automatically: `smoke-test.yml` runs after `homebrew-releaser.yml` and installs `cpool` from the tap on both macOS and Linux.
Homebrew is verified automatically: `smoke-test.yml` triggers after `release.yml` completes and installs `cpool` from the tap on both macOS and Linux.

Winget requires a manual check once the winget-pkgs PR is merged:

Expand Down Expand Up @@ -69,7 +69,7 @@ All three secrets are set at **https://github.com/piers-sinclair/cardpool/settin

`packaging/homebrew/cpool.rb` in this repository is the **single source of truth** for the Homebrew formula. Never edit [piers-sinclair/homebrew-cpool](https://github.com/piers-sinclair/homebrew-cpool) directly.

On each release, `homebrew-releaser.yml` copies the full formula file from this repo into the tap and replaces the placeholder SHA256 values with real hashes. Any change to the formula — description, install logic, test, URL pattern — belongs in `packaging/homebrew/cpool.rb` here and takes effect on the next release.
On each release, the `homebrew` job in `release.yml` copies the full formula file from this repo into the tap and replaces the placeholder SHA256 values with real hashes. Any change to the formula — description, install logic, test, URL pattern — belongs in `packaging/homebrew/cpool.rb` here and takes effect on the next release.

## Packaging reference files

Expand Down