diff --git a/.github/workflows/publish-releases.yml b/.github/workflows/publish-releases.yml new file mode 100644 index 0000000..3486e77 --- /dev/null +++ b/.github/workflows/publish-releases.yml @@ -0,0 +1,51 @@ +# This workflow handles tagged releases. +# +# Whenever a tag is pushed, this produces a clean build, creates +# a github release for the thag and attaches the build results. +name: Release Workflow +on: + push: + tags: + - '*' +env: + CHANGELOG: Changelog.md + RELEASE_CHANGELOG: Release.md + +jobs: + build_and_publish: + name: Build and publish release + runs-on: ubuntu-latest + steps: + - name: Checkout tag + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install tools + run: | + sudo apt update + sudo apt install build-essential gcc-avr avr-libc gcc-arm-none-eabi + + - name: Build libopencm3 for STM32G0 + run: | + make -C libopencm3 lib/stm32/g0 CFLAGS='-flto -fno-fat-lto-objects' + + - name: Build firmware + run: | + make + + - name: Generate changelog + run: | + # This prints the first two lines and then up to the next + # heading (next version), and then uses head to remove that + # heading again + sed -n '1p; 2,/^===/p' "${CHANGELOG}" | head -n -2 > "${RELEASE_CHANGELOG}" + + - name: release + uses: softprops/action-gh-release@v1 + with: + body_path: ${{ env.RELEASE_CHANGELOG }} + files: | + *.bin + *.hex + *.elf