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

Commit 8021da8

Browse files
shikharclaude
andcommitted
fix: have release-plz publish to crates.io directly
- Pass CARGO_REGISTRY_TOKEN to release-plz for crates.io publishing - Trigger release.yml on PR merge instead of tag push - Explicitly enable git tagging and releases in release-plz config GITHUB_TOKEN-created tags don't trigger other workflows, so we now trigger on release PR merge directly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 14dd1ac commit 8021da8

3 files changed

Lines changed: 28 additions & 28 deletions

File tree

.github/workflows/release-tag.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [closed]
66

77
jobs:
8-
release-tag:
8+
release:
99
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
1010
runs-on: ubuntu-latest
1111
permissions:
@@ -25,3 +25,4 @@ jobs:
2525
command: release
2626
env:
2727
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

.github/workflows/release.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
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:
79
build_binaries:
10+
if: |
11+
github.event_name == 'workflow_dispatch' ||
12+
(github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release'))
813
name: ${{ matrix.target }}
914
runs-on: ${{ matrix.os }}
1015
strategy:
@@ -38,7 +43,7 @@ jobs:
3843
target: aarch64-pc-windows-msvc
3944
steps:
4045
- name: checkout
41-
uses: actions/checkout@v4
46+
uses: actions/checkout@v4
4247
- uses: actions-rust-lang/setup-rust-toolchain@v1
4348
with:
4449
rustflags: ""
@@ -59,7 +64,7 @@ jobs:
5964
if: matrix.os == 'macos-latest'
6065
run: |
6166
echo "${{ secrets.MACOS_PEM }}" | base64 -d -o macos.pem
62-
echo "${{ secrets.MACOS_CERTIFICATE_DER }}" | base64 -d -o certificate.der
67+
echo "${{ secrets.MACOS_CERTIFICATE_DER }}" | base64 -d -o certificate.der
6368
- name: Sign macos binary
6469
if: matrix.os == 'macos-latest'
6570
uses: indygreg/apple-code-sign-action@v1
@@ -73,20 +78,20 @@ jobs:
7378
shell: bash
7479
run: |
7580
cd target/${{ matrix.target }}/release
76-
77-
if [ "${{ matrix.os }}" = "windows-latest" ];
81+
82+
if [ "${{ matrix.os }}" = "windows-latest" ];
7883
then
7984
7z a ../../../s2-${{ matrix.target }}.zip s2.exe
8085
else
8186
zip -r ../../../s2-${{ matrix.target }}.zip s2
82-
fi
87+
fi
8388
- name: App store connect api key
8489
if: matrix.os == 'macos-latest'
8590
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'
91+
- name: Notarize macos binary
92+
if: matrix.os == 'macos-latest'
8893
uses: indygreg/apple-code-sign-action@v1
89-
with:
94+
with:
9095
input_path: s2-${{ matrix.target }}.zip
9196
sign: false
9297
notarize: true
@@ -95,14 +100,13 @@ jobs:
95100
uses: actions/upload-artifact@v4
96101
with:
97102
name: ${{ matrix.target }}
98-
path: |
103+
path: |
99104
*.zip
100105
if-no-files-found: error
101106

102107
create_release:
103108
needs: build_binaries
104109
runs-on: ubuntu-22.04
105-
if: github.event_name != 'workflow_dispatch'
106110
permissions:
107111
contents: write
108112
steps:
@@ -118,25 +122,21 @@ jobs:
118122
id: changelog_reader
119123
with:
120124
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 }}
125125
- name: download artifacts
126126
uses: actions/download-artifact@v4
127127
- name: create release
128128
uses: softprops/action-gh-release@v2
129129
with:
130+
tag_name: ${{ steps.version.outputs.value }}
130131
files: |
131132
**/*.tar.gz
132133
**/*.zip
133134
name: ${{ steps.version.outputs.value }}
134-
body: ${{ steps.changelog_reader.outputs.changes }}
135+
body: ${{ steps.changelog_reader.outputs.changes }}
135136

136137
update_homebrew:
137138
needs: [create_release, build_binaries]
138139
runs-on: ubuntu-22.04
139-
if: github.event_name != 'workflow_dispatch'
140140
steps:
141141
- name: checkout
142142
uses: actions/checkout@v4
@@ -147,29 +147,29 @@ jobs:
147147
file: Cargo.toml
148148
field: package.version
149149
- name: Download artifacts
150-
uses: actions/download-artifact@v4
150+
uses: actions/download-artifact@v4
151151
- name: sha256sum
152-
run: |
152+
run: |
153153
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
154+
echo "LINUX_INTEL_SHA256=$LINUX_INTEL_SHA256" >> $GITHUB_ENV
155155
LINUX_ARM_SHA256=$(shasum -a 256 aarch64-unknown-linux-gnu/s2-aarch64-unknown-linux-gnu.zip | awk '{print $1}')
156156
echo "LINUX_ARM_SHA256=$LINUX_ARM_SHA256" >> $GITHUB_ENV
157157
MAC_INTEL_SHA256=$(shasum -a 256 x86_64-apple-darwin/s2-x86_64-apple-darwin.zip | awk '{print $1}')
158158
echo "MAC_INTEL_SHA256=$MAC_INTEL_SHA256" >> $GITHUB_ENV
159159
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
160+
echo "MAC_ARM_SHA256=$MAC_ARM_SHA256" >> $GITHUB_ENV
161161
- name: checkout into the formula repo
162162
uses: actions/checkout@v4
163163
with:
164164
repository: 's2-streamstore/homebrew-s2'
165165
token: ${{ secrets.HOMEBREW_PAT }}
166166
- name: update formula
167-
run: |
167+
run: |
168168
sed -i.bak "s/^ version \".*\"$/ version \"${{ steps.version.outputs.value }}\"/" s2.rb
169169
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.MAC_INTEL_SHA256 }}/1' s2.rb
170170
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.MAC_ARM_SHA256 }}/2' s2.rb
171171
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
172+
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.LINUX_ARM_SHA256 }}/4' s2.rb
173173
- name: release
174174
run: |
175175
git config --global user.email "mehul@s2.dev"

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)