Skip to content

Commit b63538b

Browse files
ekropotinclaude
andauthored
ci: streamline release process and add Homebrew automation (#140)
Major improvements to the CI/CD pipeline: - **Simplified version bump workflow**: Removed complex prerelease and force options, added automatic crates.io publishing with CARGO_REGISTRY_TOKEN - **New Homebrew automation**: Added homebrew-update.yml workflow that automatically updates the Homebrew formula when releases are published, with manual dispatch option - **Streamlined release workflows**: Removed individual crate publishing from release workflows, added proper git fetch configuration with full history and tags - **Enhanced release configuration**: Removed restrictive flags (verify=false, push=false, publish=false) from release.toml to enable proper cargo-release functionality This consolidates the release process into a more maintainable and automated system that reduces manual intervention while ensuring reliable package distribution across crates.io and Homebrew. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4033d04 commit b63538b

6 files changed

Lines changed: 73 additions & 53 deletions

File tree

.github/workflows/crates-version-bump.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@ name: Crates Version Bump
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
pre-id:
7-
description: 'Prerelease identifier for prerelease versions'
8-
required: false
9-
default: 'alpha'
10-
type: choice
11-
options:
12-
- beta
13-
- rc
14-
force:
15-
description: 'Force version bump even if no changes detected'
16-
required: false
17-
default: false
18-
type: boolean
195

206
jobs:
217
bump-version:
@@ -43,17 +29,19 @@ jobs:
4329
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4430
4531
- name: Run version bump
32+
env:
33+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
4634
run: |
4735
BRANCH="${GITHUB_REF_NAME}"
48-
PRE_ID="${{ inputs.pre-id }}"
49-
FORCE="${{ inputs.force }}"
5036
REPO_ROOT="$(git rev-parse --show-toplevel)"
5137
5238
echo "Running on branch: $BRANCH"
53-
echo "Prerelease identifier: $PRE_ID"
5439
5540
$REPO_ROOT/scripts/bump-version.sh
5641
42+
echo "publishing on crates.io"
43+
cargo release publish --workspace --execute
44+
5745
git push origin "$BRANCH"
5846
git push origin --tags
5947
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Update Homebrew Formula
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to update to (e.g., 1.0.1)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
update-homebrew:
15+
name: Update Homebrew Formula
16+
runs-on: macos-latest
17+
if: contains(github.event.release.tag_name, 'quickmark-cli@') || github.event_name == 'workflow_dispatch'
18+
19+
steps:
20+
- name: Extract version
21+
id: version
22+
run: |
23+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
24+
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
25+
else
26+
# Extract version from tag (quickmark-cli@1.0.0 -> 1.0.0)
27+
version="${{ github.event.release.tag_name }}"
28+
version="${version#quickmark-cli@}"
29+
echo "version=$version" >> $GITHUB_OUTPUT
30+
fi
31+
32+
- name: Setup Homebrew
33+
id: set-up-homebrew
34+
uses: Homebrew/actions/setup-homebrew@master
35+
36+
- name: Update Homebrew formula using bump-formula-pr
37+
env:
38+
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
run: |
40+
# Use brew bump-formula-pr to automatically update the formula
41+
brew bump-formula-pr \
42+
--tap=ekropotin/homebrew-formula \
43+
--version="${{ steps.version.outputs.version }}" \
44+
--message="chore(brew): quickmark-cli ${{ steps.version.outputs.version }}
45+
46+
Updates quickmark-cli to version ${{ steps.version.outputs.version }}.
47+
48+
This PR was automatically created by the quickmark release workflow." \
49+
--no-browse \
50+
--no-fork \
51+
quickmark-cli || {
52+
echo "Failed to create PR. Possible reasons:"
53+
echo "1. The version is already up to date"
54+
echo "2. The release assets are not yet available"
55+
echo "3. There was a network issue"
56+
echo "4. The formula doesn't exist or has issues"
57+
exit 1
58+
}

.github/workflows/release-cli.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
fetch-tags: true
1821

1922
- name: Setup Rust
2023
uses: dtolnay/rust-toolchain@stable
@@ -34,9 +37,6 @@ jobs:
3437
with:
3538
tool: cargo-release,git-cliff
3639

37-
- name: Publish quickmark-cli to crates.io
38-
run: cargo publish -p quickmark-cli --token ${{ secrets.CRATES_IO_TOKEN }}
39-
4040
- name: Generate changelog
4141
id: changelog
4242
run: |

.github/workflows/release-core.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
fetch-tags: true
1821

1922
- name: Setup Rust
2023
uses: dtolnay/rust-toolchain@stable
@@ -34,9 +37,6 @@ jobs:
3437
with:
3538
tool: cargo-release,git-cliff
3639

37-
- name: Publish quickmark-core to crates.io
38-
run: cargo publish -p quickmark-core --token ${{ secrets.CRATES_IO_TOKEN }}
39-
4040
- name: Generate changelog
4141
id: changelog
4242
run: |

.github/workflows/release-server.yml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
fetch-tags: true
3538

3639
- name: Setup Rust
3740
uses: dtolnay/rust-toolchain@stable
@@ -78,35 +81,9 @@ jobs:
7881
path: ${{ steps.binary-archive.outputs.archive_name }}
7982
if-no-files-found: error
8083

81-
publish:
82-
name: Publish to crates.io
83-
runs-on: ubuntu-latest
84-
needs: build
85-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/quickmark-server@')
86-
87-
steps:
88-
- name: Checkout code
89-
uses: actions/checkout@v4
90-
91-
- name: Setup Rust
92-
uses: dtolnay/rust-toolchain@stable
93-
94-
- name: Cache cargo registry
95-
uses: actions/cache@v4
96-
with:
97-
path: |
98-
~/.cargo/registry
99-
~/.cargo/git
100-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
101-
restore-keys: |
102-
${{ runner.os }}-cargo-
103-
104-
- name: Publish quickmark-server to crates.io
105-
run: cargo publish -p quickmark-server --token ${{ secrets.CRATES_IO_TOKEN }}
106-
10784
release:
10885
name: Create Release
109-
needs: [build, publish]
86+
needs: [build]
11087
runs-on: ubuntu-latest
11188
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/quickmark-server@')
11289
permissions:

release.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
# pre-release-commit-message = "chore: Release {{crate_name}} version {{version}}"
22
tag-name = "{{crate_name}}@{{version}}"
3-
verify = false
4-
push = false
5-
publish = false
63
consolidate-commits = true

0 commit comments

Comments
 (0)