Skip to content

Commit 6c15574

Browse files
committed
ci: add release workflows
Signed-off-by: Qiming Chu <[email protected]>
1 parent c418876 commit 6c15574

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release Git Commit Generator
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Version tag (e.g., v0.1.0)'
10+
required: true
11+
default: 'v0.1.0'
12+
jobs:
13+
build-and-release:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, macos-latest]
18+
include:
19+
- os: ubuntu-latest
20+
asset_name: git-commit-generator-linux
21+
asset_content_type: application/octet-stream
22+
- os: macos-latest
23+
asset_name: git-commit-generator-macos
24+
asset_content_type: application/octet-stream
25+
permissions:
26+
contents: write
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
- name: Set up Git
33+
if: github.event_name == 'workflow_dispatch'
34+
run: |
35+
git tag ${{ github.event.inputs.tag }} || echo "Tag already exists"
36+
- name: Get version
37+
id: get_version
38+
run: |
39+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
40+
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
41+
else
42+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
43+
fi
44+
echo "RELEASE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
45+
- name: Setup Nix
46+
uses: DeterminateSystems/nix-installer-action@main
47+
- name: Setup project
48+
run: |
49+
nix build -L
50+
cp result/bin/git-commit-generator ${{ matrix.asset_name }}
51+
- name: Calculate checksums
52+
id: checksums
53+
run: |
54+
echo "SHA256=$(sha256sum ${{ matrix.asset_name }} | awk '{print $1}')" >> $GITHUB_ENV
55+
echo "MD5=$(md5sum ${{ matrix.asset_name }} | awk '{print $1}')" >> $GITHUB_ENV
56+
- name: Create GitHub Release
57+
uses: softprops/action-gh-release@v1
58+
with:
59+
name: Git Commit Generator ${{ env.VERSION }}
60+
tag_name: ${{ env.VERSION }}
61+
draft: false
62+
prerelease: false
63+
body: |
64+
# Git Commit Generator ${{ env.VERSION }}
65+
66+
Release date: ${{ env.RELEASE_DATE }}
67+
68+
## 📦 Support Platforms
69+
- Linux (x86_64)
70+
- macOS (x86_64, arm64)
71+
72+
## 🔑 Features
73+
- Automatically analyze staged Git changes
74+
- Generate semantic commit messages using DeepSeek AI
75+
- Simple and easy-to-use command line interface
76+
77+
## 🔢 Checksums (${{ matrix.asset_name }})
78+
- SHA256: ${{ env.SHA256 }}
79+
- MD5: ${{ env.MD5 }}
80+
81+
## 📝 Installation
82+
83+
### Download
84+
```bash
85+
chmod +x git-commit-generator-*
86+
sudo mv git-commit-generator-* /usr/local/bin/git-commit-generator
87+
```
88+
89+
### Use Nix
90+
```bash
91+
nix run github:Emin017/git-commit-generator
92+
```
93+
files: |
94+
${{ matrix.asset_name }}
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)