Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit 05496a5

Browse files
shikharclaude
andauthored
chore: consolidate release workflows (#211)
## Summary - Merge `release-tag.yml` into `release.yml` for a single release workflow - Trigger on release PR merge instead of tag push (GITHUB_TOKEN-created tags don't trigger workflows) - Add `release_plz` job to handle: git tag, crates.io publish, GitHub release with changelog - Enable `git_tag_enable` and `git_release_enable` in release-plz config ## Flow 1. Push to main → release-plz creates/updates release PR 2. Merge release PR → `release.yml` runs: - `release_plz`: tag + crates.io + GitHub release - `build_binaries`: cross-platform builds + signing - `upload_release_artifacts`: attach binaries to release - `update_homebrew`: update formula 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1c62c3a commit 05496a5

3 files changed

Lines changed: 61 additions & 74 deletions

File tree

.github/workflows/release-tag.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
name: release
2-
on:
3-
push:
4-
tags: ["[0-9]+.[0-9]+.[0-9]+*"]
2+
3+
on:
4+
pull_request:
5+
types: [closed]
56
workflow_dispatch:
7+
68
jobs:
9+
release_plz:
10+
if: |
11+
github.event_name == 'workflow_dispatch' ||
12+
(github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release'))
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Install Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
25+
- name: Run release-plz release
26+
uses: release-plz/action@v0.5
27+
with:
28+
command: release
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
32+
733
build_binaries:
34+
needs: release_plz
835
name: ${{ matrix.target }}
936
runs-on: ${{ matrix.os }}
1037
strategy:
@@ -37,8 +64,8 @@ jobs:
3764
- os: windows-latest
3865
target: aarch64-pc-windows-msvc
3966
steps:
40-
- name: checkout
41-
uses: actions/checkout@v4
67+
- name: Checkout
68+
uses: actions/checkout@v4
4269
- uses: actions-rust-lang/setup-rust-toolchain@v1
4370
with:
4471
rustflags: ""
@@ -59,7 +86,7 @@ jobs:
5986
if: matrix.os == 'macos-latest'
6087
run: |
6188
echo "${{ secrets.MACOS_PEM }}" | base64 -d -o macos.pem
62-
echo "${{ secrets.MACOS_CERTIFICATE_DER }}" | base64 -d -o certificate.der
89+
echo "${{ secrets.MACOS_CERTIFICATE_DER }}" | base64 -d -o certificate.der
6390
- name: Sign macos binary
6491
if: matrix.os == 'macos-latest'
6592
uses: indygreg/apple-code-sign-action@v1
@@ -73,104 +100,92 @@ jobs:
73100
shell: bash
74101
run: |
75102
cd target/${{ matrix.target }}/release
76-
77-
if [ "${{ matrix.os }}" = "windows-latest" ];
103+
104+
if [ "${{ matrix.os }}" = "windows-latest" ];
78105
then
79106
7z a ../../../s2-${{ matrix.target }}.zip s2.exe
80107
else
81108
zip -r ../../../s2-${{ matrix.target }}.zip s2
82-
fi
109+
fi
83110
- name: App store connect api key
84111
if: matrix.os == 'macos-latest'
85112
run: echo "${{ secrets.APP_STORE_CONNECT_API_KEY }}" | base64 -d -o app_store_connect_api_key.json
86-
- name: Notarize macos binary
87-
if: matrix.os == 'macos-latest'
113+
- name: Notarize macos binary
114+
if: matrix.os == 'macos-latest'
88115
uses: indygreg/apple-code-sign-action@v1
89-
with:
116+
with:
90117
input_path: s2-${{ matrix.target }}.zip
91118
sign: false
92119
notarize: true
93120
app_store_connect_api_key_json_file: app_store_connect_api_key.json
94-
- name: upload artifacts
121+
- name: Upload artifacts
95122
uses: actions/upload-artifact@v4
96123
with:
97124
name: ${{ matrix.target }}
98-
path: |
125+
path: |
99126
*.zip
100127
if-no-files-found: error
101128

102-
create_release:
129+
upload_release_artifacts:
103130
needs: build_binaries
104131
runs-on: ubuntu-22.04
105-
if: github.event_name != 'workflow_dispatch'
106132
permissions:
107133
contents: write
108134
steps:
109-
- name: checkout
135+
- name: Checkout
110136
uses: actions/checkout@v4
111-
- name: version
137+
- name: Get version
112138
id: version
113139
uses: SebRollen/toml-action@v1.2.0
114140
with:
115141
file: Cargo.toml
116142
field: package.version
117-
- uses: mindsers/changelog-reader-action@v2
118-
id: changelog_reader
119-
with:
120-
version: ${{ steps.version.outputs.value }}
121-
- name: install rust
122-
uses: dtolnay/rust-toolchain@stable
123-
- name: publish to crates.io
124-
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
125-
- name: download artifacts
143+
- name: Download artifacts
126144
uses: actions/download-artifact@v4
127-
- name: create release
145+
- name: Upload to release
128146
uses: softprops/action-gh-release@v2
129147
with:
148+
tag_name: ${{ steps.version.outputs.value }}
130149
files: |
131-
**/*.tar.gz
132150
**/*.zip
133-
name: ${{ steps.version.outputs.value }}
134-
body: ${{ steps.changelog_reader.outputs.changes }}
135151
136152
update_homebrew:
137-
needs: [create_release, build_binaries]
153+
needs: build_binaries
138154
runs-on: ubuntu-22.04
139-
if: github.event_name != 'workflow_dispatch'
140155
steps:
141-
- name: checkout
156+
- name: Checkout
142157
uses: actions/checkout@v4
143-
- name: version
158+
- name: Get version
144159
id: version
145160
uses: SebRollen/toml-action@v1.2.0
146161
with:
147162
file: Cargo.toml
148163
field: package.version
149164
- name: Download artifacts
150-
uses: actions/download-artifact@v4
151-
- name: sha256sum
152-
run: |
165+
uses: actions/download-artifact@v4
166+
- name: Calculate checksums
167+
run: |
153168
LINUX_INTEL_SHA256=$(shasum -a 256 x86_64-unknown-linux-gnu/s2-x86_64-unknown-linux-gnu.zip | awk '{print $1}')
154-
echo "LINUX_INTEL_SHA256=$LINUX_INTEL_SHA256" >> $GITHUB_ENV
169+
echo "LINUX_INTEL_SHA256=$LINUX_INTEL_SHA256" >> $GITHUB_ENV
155170
LINUX_ARM_SHA256=$(shasum -a 256 aarch64-unknown-linux-gnu/s2-aarch64-unknown-linux-gnu.zip | awk '{print $1}')
156171
echo "LINUX_ARM_SHA256=$LINUX_ARM_SHA256" >> $GITHUB_ENV
157172
MAC_INTEL_SHA256=$(shasum -a 256 x86_64-apple-darwin/s2-x86_64-apple-darwin.zip | awk '{print $1}')
158173
echo "MAC_INTEL_SHA256=$MAC_INTEL_SHA256" >> $GITHUB_ENV
159174
MAC_ARM_SHA256=$(shasum -a 256 aarch64-apple-darwin/s2-aarch64-apple-darwin.zip | awk '{print $1}')
160-
echo "MAC_ARM_SHA256=$MAC_ARM_SHA256" >> $GITHUB_ENV
161-
- name: checkout into the formula repo
175+
echo "MAC_ARM_SHA256=$MAC_ARM_SHA256" >> $GITHUB_ENV
176+
- name: Checkout homebrew repo
162177
uses: actions/checkout@v4
163178
with:
164179
repository: 's2-streamstore/homebrew-s2'
165180
token: ${{ secrets.HOMEBREW_PAT }}
166-
- name: update formula
167-
run: |
181+
- name: Update formula
182+
run: |
168183
sed -i.bak "s/^ version \".*\"$/ version \"${{ steps.version.outputs.value }}\"/" s2.rb
169184
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.MAC_INTEL_SHA256 }}/1' s2.rb
170185
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.MAC_ARM_SHA256 }}/2' s2.rb
171186
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.LINUX_INTEL_SHA256 }}/3' s2.rb
172-
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.LINUX_ARM_SHA256 }}/4' s2.rb
173-
- name: release
187+
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.LINUX_ARM_SHA256 }}/4' s2.rb
188+
- name: Push formula
174189
run: |
175190
git config --global user.email "mehul@s2.dev"
176191
git config --global user.name "Mehul Arora"

release-plz.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[workspace]
22
changelog_config = "cliff.toml"
3-
publish = false
43
git_tag_enable = true
54
git_tag_name = "{{ version }}"
6-
git_release_enable = false
5+
git_release_enable = true
76
pr_labels = ["release"]

0 commit comments

Comments
 (0)