-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.42 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: main
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
release:
types: [ published ]
workflow_dispatch:
env:
BUILD_TYPE: release
FW_VERSION: ${GITHUB_REF##*/}
REPOSITORY_NAME: ${GITHUB_REPOSITORY##*/}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup GNU Arm Embedded Toolchain
uses: carlosperate/[email protected]
- name: Setup env
run: |
echo "REPORSIORY=${{env.REPOSITORY_NAME}}" >> "$GITHUB_ENV"
echo "FW_VERSION=${{env.FW_VERSION}}" >> "$GITHUB_ENV"
- name: Setup Ninja
uses: ashutoshvarma/[email protected]
- name: Configure CMake
run: cmake -B ${{github.workspace}}/obj/${{env.BUILD_TYPE}} . -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/sdk/toolchain/toolchain.cmake -DTYPE=${{env.BUILD_TYPE}}
- name: Build With Ninja
run: ninja -C ${{github.workspace}}/obj/${{env.BUILD_TYPE}}
- name: Rename Firmware
if: ${{ github.event_name == 'release' }}
run: mv ${{github.workspace}}/out/release/firmware.bin ${{env.REPOSITORY_NAME}}-${{env.FW_VERSION}}.bin
- name: Release
if: ${{ github.event_name == 'release' }}
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: ${{env.REPORSIORY}}-${{env.FW_VERSION}}.bin