Skip to content

Commit 224c82b

Browse files
committed
Add release workflow for automatic GitHub releases on version tags
1 parent 0358463 commit 224c82b

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 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+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: "20"
20+
21+
- name: Build dataset
22+
run: node scripts/build.js
23+
24+
- name: Extract version from tag
25+
id: version
26+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
27+
28+
- name: Extract changelog for this version
29+
id: changelog
30+
run: |
31+
# Extract the section for this version from CHANGELOG.md
32+
awk '/^## \['"${{ steps.version.outputs.version }}"'\]/{found=1; next} /^## /{if(found) exit} found' CHANGELOG.md > /tmp/release-notes.md
33+
echo "body<<RELEASE_EOF" >> "$GITHUB_OUTPUT"
34+
cat /tmp/release-notes.md >> "$GITHUB_OUTPUT"
35+
echo "RELEASE_EOF" >> "$GITHUB_OUTPUT"
36+
37+
- name: Create GitHub Release
38+
uses: softprops/action-gh-release@v2
39+
with:
40+
name: v${{ steps.version.outputs.version }}
41+
body: ${{ steps.changelog.outputs.body }}
42+
files: |
43+
data/cameras.json
44+
data/cameras.csv

0 commit comments

Comments
 (0)