Skip to content

Commit 4cb43f3

Browse files
hallclaude
andcommitted
trigger releases from CHANGELOG.md
- add Keep a Changelog format CHANGELOG.md - CI now triggers on CHANGELOG.md changes to master - parses latest version and release notes from CHANGELOG - skips if tag already exists - rename default branch from `master` to `main` Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 3a5f37d commit 4cb43f3

File tree

2 files changed

+74
-4
lines changed

2 files changed

+74
-4
lines changed

.github/workflows/main.yaml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,51 @@
11
name: Release
22
on:
33
push:
4-
tags:
5-
- "*"
4+
branches:
5+
- main
6+
paths:
7+
- CHANGELOG.md
68
jobs:
79
release:
810
runs-on: ubuntu-latest
911
steps:
1012
- name: Checkout
1113
uses: actions/checkout@v4
1214

15+
- name: Get version from CHANGELOG
16+
id: version
17+
run: |
18+
VERSION=$(grep -m1 -oP '## \[\K[^\]]+' CHANGELOG.md)
19+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
20+
21+
# extract release notes between first and second ## heading
22+
BODY=$(awk '/^## \[/{if(n++)exit}n' CHANGELOG.md)
23+
{
24+
echo "body<<RELEASE_EOF"
25+
echo "$BODY"
26+
echo "RELEASE_EOF"
27+
} >> "$GITHUB_OUTPUT"
28+
29+
- name: Check if tag exists
30+
id: check
31+
run: |
32+
if git rev-parse "${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
33+
echo "exists=true" >> "$GITHUB_OUTPUT"
34+
else
35+
echo "exists=false" >> "$GITHUB_OUTPUT"
36+
fi
37+
1338
- name: Install Nix
39+
if: steps.check.outputs.exists == 'false'
1440
uses: cachix/install-nix-action@v31
1541

1642
- name: Build
43+
if: steps.check.outputs.exists == 'false'
44+
env:
45+
VERSION: ${{ steps.version.outputs.version }}
1746
run: |
1847
nix develop --command bash -c '
19-
sed -i "s|{/\* VERSION \*/}.*|${GITHUB_REF##*/}|g" src/index.jsx
48+
sed -i "s|{/\* VERSION \*/}.*|${VERSION}|g" src/index.jsx
2049
2150
npm ci
2251
npm run build
@@ -27,7 +56,9 @@ jobs:
2756
'
2857
2958
- name: Release
59+
if: steps.check.outputs.exists == 'false'
3060
uses: softprops/action-gh-release@v2
31-
if: startsWith(github.ref, 'refs/tags/')
3261
with:
62+
tag_name: ${{ steps.version.outputs.version }}
63+
body: ${{ steps.version.outputs.body }}
3364
files: "*.zip"

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/).
7+
8+
## [0.5.0]
9+
10+
### Changed
11+
12+
- Migrate from preact-cli to vite
13+
- Replace react-modal, axios, and lodash with native APIs
14+
- Convert class components to functional components
15+
- Use nix in CI workflow
16+
17+
## [0.4.0]
18+
19+
### Removed
20+
21+
- Unused lighttpd configuration
22+
23+
## [0.3.2]
24+
25+
### Changed
26+
27+
- Use nord theme for softer color palette
28+
29+
## [0.3.1]
30+
31+
### Changed
32+
33+
- Simplify and cleanup table layout
34+
35+
## [0.3.0]
36+
37+
### Changed
38+
39+
- Grey-out rows of ports which aren't established

0 commit comments

Comments
 (0)