Skip to content

Commit dd9f654

Browse files
committed
ci: new action to release on demand
1 parent bca9471 commit dd9f654

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: Bump type
8+
required: true
9+
type: choice
10+
options: [patch, minor, major]
11+
default: patch
12+
13+
jobs:
14+
create-release:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Bun
26+
uses: oven-sh/setup-bun@v2
27+
with:
28+
bun-version: latest
29+
30+
- name: Determine next version
31+
id: version
32+
run: |
33+
# Get last tag or default to 0.0.0
34+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
35+
echo "Last tag: $LAST_TAG"
36+
37+
# Strip leading v
38+
LAST_VERSION="${LAST_TAG#v}"
39+
40+
# Bump using bun
41+
NEW_VERSION=$(bunx semver "$LAST_VERSION" --increment ${{ github.event.inputs.bump }})
42+
echo "New version: $NEW_VERSION"
43+
44+
# Export version
45+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
46+
47+
- name: Create and push tag
48+
run: |
49+
git tag "v${{ steps.version.outputs.new_version }}"
50+
git push origin "v${{ steps.version.outputs.new_version }}"
51+
52+
- name: Generate Changelog
53+
run: bunx changelogithub --name "DimLED Mini v${{ steps.version.outputs.new_version }}"
54+
continue-on-error: true
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)