Skip to content

Commit 0fb4521

Browse files
authored
Merge pull request #7 from codellm-devkit/5-release-automation
Add release automation.
2 parents cf5012b + d807927 commit 0fb4521

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/release.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Rust Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Rust
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
toolchain: stable
23+
24+
- name: Cache dependencies
25+
uses: Swatinem/rust-cache@v2
26+
27+
- name: Build and Test
28+
id: build
29+
continue-on-error: true # Allow the workflow to continue if this fails
30+
run: |
31+
cargo build --release
32+
cargo test --release
33+
34+
- name: Delete tag on failure
35+
if: steps.build.outcome != 'success'
36+
run: |
37+
git push --delete origin ${GITHUB_REF#refs/tags/}
38+
exit 1 # Fail the workflow
39+
40+
- name: Build Changelog
41+
id: gen_changelog
42+
uses: mikepenz/release-changelog-builder-action@v5
43+
with:
44+
failOnError: "true"
45+
configuration: .github/workflows/release_config.json
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Package Release Assets
50+
run: |
51+
cd target/release
52+
# For Linux
53+
tar -czf ../../my-app-linux.tar.gz my-app
54+
# For Windows (if cross-compilation is set up)
55+
# zip ../../my-app-windows.zip my-app.exe
56+
cd ../..
57+
58+
- name: Publish Release
59+
uses: softprops/action-gh-release@v1
60+
with:
61+
files: |
62+
my-app-linux.tar.gz
63+
# my-app-windows.zip
64+
body: ${{ steps.gen_changelog.outputs.changelog }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release_config.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## 🚀 Features",
5+
"labels": ["kind/feature", "enhancement"]
6+
},
7+
{
8+
"title": "## 🐛 Fixes",
9+
"labels": ["fix", "bug"]
10+
},
11+
{
12+
"title": "## ♻️ Refactoring",
13+
"labels": ["refactoring"]
14+
},
15+
{
16+
"title": "## ⚡️ Performance Improvements",
17+
"labels": ["performance"]
18+
},
19+
{
20+
"title": "## \uD83D\uDCDA Documentation",
21+
"labels": ["documentation", "doc"]
22+
},
23+
{
24+
"title": "## \uD83D\uDEA6 Tests",
25+
"labels": ["test"]
26+
},
27+
{
28+
"title": "## \uD83D\uDEE0 Other Updates",
29+
"labels": ["other", "kind/dependency-change"]
30+
}
31+
],
32+
"ignore_labels": [
33+
"ignore"
34+
]
35+
}

0 commit comments

Comments
 (0)