55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
|
|
name: build_firmware
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
|
|
|
|
env:
|
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
|
BUILD_TYPE: Release
|
|
|
|
jobs:
|
|
Build:
|
|
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
|
# You can convert this to a matrix build if you need cross-platform coverage.
|
|
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install dependence
|
|
run: sudo apt install cmake gcc
|
|
|
|
- name: Build
|
|
run: cd ${{github.workspace}}/example/linux && mkdir build && cd build && cmake .. && make
|
|
|
|
- name: Create release
|
|
run: echo "release_name=$(date +v%Y.%m.%d.vv%H.%M)" >> $GITHUB_ENV
|
|
|
|
- uses: actions/create-release@v1
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.release_name }}
|
|
release_name: Release ${{ env.release_name }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload firmware
|
|
uses: actions/upload-release-asset@v1
|
|
id: upload-firmware
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ${{github.workspace}}/example/linux/build/example
|
|
asset_name: example_x86.elf
|
|
asset_content_type: application/octet-stream
|