Skip to content

Commit d32228c

Browse files
bessmanAlexander Bessman
authored andcommitted
Automate release
1 parent dd29db9 commit d32228c

File tree

2 files changed

+79
-6
lines changed

2 files changed

+79
-6
lines changed

.github/workflows/main-builder.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ on:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
workflow_call:
89

910
jobs:
1011
build:
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Download project files
14-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1516

1617
- name: Cache XC-16 Compiler
1718
id: cache-compiler
@@ -38,15 +39,33 @@ jobs:
3839
git submodule init
3940
git submodule update
4041
41-
- name: Build firmware
42+
- name: Build firmware for v6
4243
run: |
43-
mkdir build
44-
cd build
45-
cmake ..
44+
mkdir build_v6
45+
cd build_v6
46+
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
4647
make
48+
zip -r pslab-firmware_v6.zip pslab-firmware.hex
49+
50+
- name: Build firmware for v5
51+
run: |
52+
mkdir build_v5
53+
cd build_v5
54+
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEGACY_HARDWARE=1
55+
make
56+
zip -r pslab-firmware_v5.zip pslab-firmware.hex
57+
58+
- name: Build firmware for v6_esp01
59+
run: |
60+
git switch esp-01
61+
mkdir build_v6_esp01
62+
cd build_v6_esp01
63+
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
64+
make
65+
zip -r pslab-firmware_v6_esp01.zip pslab-firmware.hex
4766
4867
- name: Publish build files
4968
uses: actions/upload-artifact@v4
5069
with:
5170
name: production-file
52-
path: build/*.hex
71+
path: build*/*.zip

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
set-body:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- run: sudo apt install pcregrep
14+
15+
- uses: actions/checkout@v4
16+
17+
- name: Parse changelog
18+
id: parse-changelog
19+
run: |
20+
tag='${{ github.ref_name }}'
21+
re_current_tag="## \[$tag\].*\n\n" # Match, but do not capture, current version tag, then...
22+
re_changes_body='((.|\n)+?)' # capture everything including newlines...
23+
re_previous_tag='## \[[0-9]+.[0-9]+.[0-9]+\]' # until previous version tag.
24+
re_full="${re_current_tag}${re_changes_body}${re_previous_tag}"
25+
echo 'match<<EOF' >> $GITHUB_OUTPUT
26+
# Match multiple lines, output capture group 1.
27+
pcregrep -M -o1 "$re_full" ./CHANGELOG.md >> $GITHUB_OUTPUT
28+
echo 'EOF' >> $GITHUB_OUTPUT
29+
30+
- name: Set release body
31+
uses: softprops/action-gh-release@v2
32+
with:
33+
draft: true
34+
body: ${{ steps.parse-changelog.outputs.match }}
35+
36+
build:
37+
uses: fossasia/pslab-firmware/.github/workflows/main-builder.yml@main
38+
39+
attach-artifacts:
40+
needs: build
41+
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- name: download
46+
uses: actions/download-artifact@v4
47+
48+
- name: attach
49+
uses: softprops/action-gh-release@v2
50+
with:
51+
files: |
52+
pslab-firmware_v6.zip
53+
pslab-firmware_v5.zip
54+
pslab-firmware_v6_esp01.zip

0 commit comments

Comments
 (0)