Skip to content

Commit 20edc72

Browse files
feat: create build ci
1 parent caea64c commit 20edc72

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release Build
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+*
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-usb-flashing-files:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v6
17+
18+
- name: Install Arm GNU Toolchain
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y cmake build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
22+
23+
- name: Configure CMake
24+
run: |
25+
mkdir -p build
26+
cd build
27+
cmake .. -DCMAKE_BUILD_TYPE=Release -DPICO_SDK_FETCH_FROM_GIT=ON
28+
29+
- name: Build Firmware
30+
run: make build
31+
32+
- name: Check if release exists
33+
id: check_release
34+
run: |
35+
if gh release view ${{ github.ref_name }} --json id > /dev/null 2>&1; then
36+
echo "exists=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "exists=false" >> $GITHUB_OUTPUT
39+
fi
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Create Release
44+
if: steps.check_release.outputs.exists == 'false'
45+
uses: softprops/action-gh-release@v2
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: ${{ github.ref_name }}
50+
name: ${{ github.ref_name }}
51+
body: 'Release assets for ${{ github.ref_name }}.'
52+
draft: true
53+
prerelease: ${{ contains(github.ref_name, '-') }}
54+
55+
- name: Upload Firmware Assets
56+
uses: softprops/action-gh-release@v2
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
tag_name: ${{ github.ref_name }}
61+
files: |
62+
build/dshot/dshot.uf2
63+
build/pwm/pwm.uf2

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
check:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v6
15+
16+
- name: Checkout code
17+
uses: actions/checkout@v6
1618

1719
- name: Install dependencies
1820
run: |

0 commit comments

Comments
 (0)