Skip to content

Commit e231ad8

Browse files
committed
♻️ Replace Python release script with GitHub Actions workflow
Replace the 372-line Python release manager script with a declarative GitHub Actions workflow that handles version bumping, changelog generation, and tag creation. The new workflow provides: - Manual dispatch with version input or semantic bump type selection - Dry-run mode for validation without publishing - Integrated changelog generation using the git-iris action - Automatic CI/CD pipeline triggering via tag push Also expand the GitHub Action to support changelog generation in addition to release notes: - Add 'command' input to select between release-notes and changelog - Add 'update-file' option to prepend new content to existing files - Rename outputs for clarity (content, output-file) with backwards compatibility aliases - Add Rust toolchain caching for build-from-source mode Update README documentation to reflect the expanded action capabilities with examples for both release notes and changelog workflows.
1 parent fb776c5 commit e231ad8

File tree

4 files changed

+250
-409
lines changed

4 files changed

+250
-409
lines changed

.github/workflows/release.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Explicit version (e.g., 1.2.3) - leave empty to use bump type"
8+
required: false
9+
default: ""
10+
bump:
11+
description: "Version bump type (if version not specified)"
12+
required: false
13+
type: choice
14+
default: "patch"
15+
options:
16+
- patch
17+
- minor
18+
- major
19+
dry_run:
20+
description: "Dry run (build & test only, skip publish)"
21+
required: false
22+
type: boolean
23+
default: false
24+
skip_changelog:
25+
description: "Skip changelog generation"
26+
required: false
27+
type: boolean
28+
default: false
29+
30+
permissions:
31+
contents: write
32+
33+
concurrency:
34+
group: release
35+
cancel-in-progress: false
36+
37+
env:
38+
CARGO_TERM_COLOR: always
39+
40+
jobs:
41+
release:
42+
name: Release
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 30
45+
46+
steps:
47+
- name: "📥 Checkout"
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
token: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: "🦀 Install Rust"
54+
uses: dtolnay/rust-toolchain@stable
55+
56+
- name: "📦 Rust cache"
57+
uses: Swatinem/rust-cache@v2
58+
59+
- name: "⚙️ Configure git"
60+
run: |
61+
git config user.name "github-actions[bot]"
62+
git config user.email "github-actions[bot]@users.noreply.github.com"
63+
64+
- name: "🔍 Determine version"
65+
id: version
66+
run: |
67+
# Get current version from Cargo.toml
68+
CURRENT=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
69+
echo "Current version: $CURRENT"
70+
71+
if [[ -n "${{ inputs.version }}" ]]; then
72+
VERSION="${{ inputs.version }}"
73+
else
74+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
75+
case "${{ inputs.bump }}" in
76+
major) VERSION="$((MAJOR + 1)).0.0" ;;
77+
minor) VERSION="${MAJOR}.$((MINOR + 1)).0" ;;
78+
patch) VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" ;;
79+
esac
80+
fi
81+
82+
# Validate version format
83+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
84+
echo "::error::Invalid version format: $VERSION (expected: X.Y.Z)"
85+
exit 1
86+
fi
87+
88+
# Check if tag already exists
89+
if git tag -l "v$VERSION" | grep -q "v$VERSION"; then
90+
echo "::error::Tag v$VERSION already exists"
91+
exit 1
92+
fi
93+
94+
echo "current=$CURRENT" >> $GITHUB_OUTPUT
95+
echo "version=$VERSION" >> $GITHUB_OUTPUT
96+
echo "🚀 Releasing: $CURRENT → $VERSION"
97+
98+
- name: "📝 Update Cargo.toml version"
99+
run: |
100+
sed -i 's/^version = ".*"/version = "${{ steps.version.outputs.version }}"/' Cargo.toml
101+
echo "Updated Cargo.toml to version ${{ steps.version.outputs.version }}"
102+
103+
- name: "🔨 Build"
104+
run: cargo build --release --locked
105+
106+
- name: "🧪 Run tests"
107+
run: cargo test --locked
108+
109+
- name: "📋 Generate changelog"
110+
if: ${{ !inputs.skip_changelog && !inputs.dry_run && secrets.OPENAI_API_KEY != '' }}
111+
uses: ./
112+
with:
113+
command: changelog
114+
from: v${{ steps.version.outputs.current }}
115+
to: HEAD
116+
version-name: ${{ steps.version.outputs.version }}
117+
output-file: CHANGELOG.md
118+
update-file: "true"
119+
api-key: ${{ secrets.OPENAI_API_KEY }}
120+
build-from-source: "true"
121+
122+
- name: "📦 Update Cargo.lock"
123+
run: cargo update -p git-iris
124+
125+
- name: "✨ Commit version bump"
126+
if: ${{ !inputs.dry_run }}
127+
run: |
128+
git add Cargo.toml Cargo.lock
129+
# Also add CHANGELOG.md if it was modified
130+
git add CHANGELOG.md 2>/dev/null || true
131+
git commit -m "🔖 Release v${{ steps.version.outputs.version }}"
132+
133+
- name: "🏷️ Create and push tag"
134+
if: ${{ !inputs.dry_run }}
135+
run: |
136+
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
137+
git push origin HEAD:${{ github.ref_name }}
138+
git push origin "v${{ steps.version.outputs.version }}"
139+
140+
- name: "📊 Summary"
141+
run: |
142+
echo "## Release ${{ inputs.dry_run && '[DRY RUN] ' || '' }}v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
143+
echo "" >> $GITHUB_STEP_SUMMARY
144+
145+
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
146+
echo "✅ Build and tests passed" >> $GITHUB_STEP_SUMMARY
147+
echo "" >> $GITHUB_STEP_SUMMARY
148+
echo "**Ready to release.** Run again without dry-run to publish." >> $GITHUB_STEP_SUMMARY
149+
else
150+
echo "✅ Version bumped: ${{ steps.version.outputs.current }} → ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
151+
echo "✅ Tag created and pushed: v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
152+
echo "" >> $GITHUB_STEP_SUMMARY
153+
echo "🚀 **CI/CD pipeline triggered!** The following will happen automatically:" >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
echo "- Build release binaries (Linux x64/ARM64, macOS ARM64, Windows)" >> $GITHUB_STEP_SUMMARY
156+
echo "- Build .deb and .rpm packages" >> $GITHUB_STEP_SUMMARY
157+
echo "- Publish Docker image to Docker Hub" >> $GITHUB_STEP_SUMMARY
158+
echo "- Publish to crates.io" >> $GITHUB_STEP_SUMMARY
159+
echo "- Generate release notes with git-iris" >> $GITHUB_STEP_SUMMARY
160+
echo "- Create GitHub Release" >> $GITHUB_STEP_SUMMARY
161+
echo "- Update v1 action tag" >> $GITHUB_STEP_SUMMARY
162+
echo "" >> $GITHUB_STEP_SUMMARY
163+
echo "📦 [View CI/CD progress](https://github.com/${{ github.repository }}/actions)" >> $GITHUB_STEP_SUMMARY
164+
fi

README.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![License](https://img.shields.io/badge/License-Apache%202.0-5E81AC?style=for-the-badge&logo=apache&logoColor=white&color=3B6EA8)](https://opensource.org/licenses/Apache-2.0)
88
[![GitHub Release](https://img.shields.io/github/release/hyperb1iss/git-iris.svg?style=for-the-badge&logo=github&logoColor=white&color=9D6DB3)][releases]
99
[![Crates.io](https://img.shields.io/crates/v/git-iris.svg?style=for-the-badge&logo=rust&logoColor=white&color=D35D47)][crates]
10-
[![GitHub Action](https://img.shields.io/badge/GitHub_Action-Release_Notes-5E81AC?style=for-the-badge&logo=github-actions&logoColor=white)](https://github.com/marketplace/actions/git-iris-release-notes)
10+
[![GitHub Action](https://img.shields.io/badge/GitHub_Action-Available-5E81AC?style=for-the-badge&logo=github-actions&logoColor=white)](https://github.com/marketplace/actions/git-iris)
1111
[![Rust](https://img.shields.io/badge/rust-stable-EBCB8B?style=for-the-badge&logo=rust&logoColor=white&color=EFBB4D)](https://www.rust-lang.org/)
1212
[![ko-fi](https://img.shields.io/badge/Ko--fi-Support%20Me-A3BE8C?style=for-the-badge&logo=ko-fi&logoColor=white&color=82B062)](https://ko-fi.com/hyperb1iss)
1313

@@ -175,45 +175,63 @@ For detailed instructions, examples, and CI/CD integration, see our [Docker Usag
175175

176176
## 🤖 GitHub Action
177177

178-
Git-Iris is available as a GitHub Action for automated release note generation in your workflows:
178+
Git-Iris is available as a GitHub Action for automated release notes and changelog generation:
179+
180+
### Release Notes
179181

180182
```yaml
181183
- name: Generate release notes
182184
uses: hyperb1iss/git-iris@v1
183-
id: release_notes
185+
id: notes
184186
with:
185187
from: v1.0.0
186188
to: v1.1.0
187-
provider: openai
188189
api-key: ${{ secrets.OPENAI_API_KEY }}
189190
output-file: RELEASE_NOTES.md
190191

191192
- name: Create Release
192193
uses: softprops/action-gh-release@v2
193194
with:
194-
body: ${{ steps.release_notes.outputs.release-notes }}
195+
body: ${{ steps.notes.outputs.content }}
196+
```
197+
198+
### Changelog
199+
200+
```yaml
201+
- name: Update changelog
202+
uses: hyperb1iss/git-iris@v1
203+
with:
204+
command: changelog
205+
from: v1.0.0
206+
to: HEAD
207+
version-name: "1.1.0"
208+
api-key: ${{ secrets.OPENAI_API_KEY }}
209+
output-file: CHANGELOG.md
210+
update-file: "true" # Prepends to existing changelog
195211
```
196212
197213
### Action Inputs
198214
199215
| Input | Description | Required | Default |
200216
|-------|-------------|----------|---------|
217+
| `command` | Command: `release-notes`, `changelog` | No | `release-notes` |
201218
| `from` | Starting Git reference (tag, commit, branch) | Yes | - |
202219
| `to` | Ending Git reference | No | `HEAD` |
203220
| `provider` | LLM provider (`openai`, `anthropic`, `google`) | No | `openai` |
204221
| `model` | Model to use (provider-specific) | No | Provider default |
205222
| `api-key` | API key for the LLM provider | Yes | - |
206-
| `output-file` | File path to write release notes | No | - |
207-
| `version-name` | Explicit version name for release notes | No | - |
223+
| `output-file` | File path to write output | No | - |
224+
| `version-name` | Explicit version name | No | - |
225+
| `update-file` | Prepend to existing file (changelog) | No | `false` |
208226
| `custom-instructions` | Custom instructions for generation | No | - |
209227
| `version` | Git-Iris version to use | No | `latest` |
210228

211229
### Action Outputs
212230

213231
| Output | Description |
214232
|--------|-------------|
215-
| `release-notes` | Generated release notes content |
216-
| `release-notes-file` | Path to output file (if specified) |
233+
| `content` | Generated content |
234+
| `output-file` | Path to output file (if specified) |
217235

218236
### Supported Platforms
219237

0 commit comments

Comments
 (0)