Merge pull request #72 from xrobot-org/dev #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build_publish_firmware | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "master" ] | |
paths: | |
- '**.c' | |
- '**.h' | |
- '**.cpp' | |
- '**.hpp' | |
- '**.cmake' | |
- '**.CMakeLists.txt' | |
- 'Kconfig' | |
- '**.ld' | |
- '**.s' | |
- '**.yml' | |
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 | |
container: | |
image: ghcr.io/xrobot-org/docker-image:main | |
options: --user 0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Init submodule | |
run: git config --global --add safe.directory /__w/XRobot/XRobot && git submodule init && git submodule update | |
- name: Build | |
run: export HOME=/root && bash -c "python project.py build all all" | |
- name: Pack firmware | |
run: zip -r ./firmware.zip ./firmware | |
- 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}}/firmware.zip | |
asset_name: firmware.zip | |
asset_content_type: application/zip |