diff --git a/.github/workflows/homebrew-releaser.yml b/.github/workflows/homebrew-releaser.yml deleted file mode 100644 index 73c3820..0000000 --- a/.github/workflows/homebrew-releaser.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Homebrew Release - -on: - release: - types: [published] - -jobs: - homebrew: - 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: ${{ github.ref_name }} - run: | - set -euo pipefail - VERSION="${VERSION#v}" - BASE="https://github.com/piers-sinclair/cardpool/releases/download/v${VERSION}" - - 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: - VERSION: ${{ github.ref_name }} - working-directory: tap - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add Formula/cpool.rb - git commit -m "cpool ${VERSION}" - git push diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4bbe184..c6bb9e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index a9c683f..724df19 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -2,7 +2,7 @@ name: Package Manager Smoke Test on: workflow_run: - workflows: ["Homebrew Release"] + workflows: ["Release"] types: [completed] workflow_dispatch: inputs: diff --git a/.github/workflows/winget-releaser.yml b/.github/workflows/winget-releaser.yml deleted file mode 100644 index 6288cf2..0000000 --- a/.github/workflows/winget-releaser.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Winget Release - -on: - release: - types: [published] - -jobs: - winget: - runs-on: windows-latest - steps: - - uses: vedantmgoyal9/winget-releaser@v2 - with: - identifier: PiersSinclair.CardPool - installers-regex: 'cpool-win-(x64|arm64)\.zip$' - token: ${{ secrets.WINGET_TOKEN }} diff --git a/RELEASING.md b/RELEASING.md index 573568f..f7fbe17 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -18,14 +18,14 @@ Merging a version bump triggers `release.yml`, which: 3. Creates a GitHub Release tagged `v` 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: @@ -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