fix: Limit github actions to master branch #8
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
on: | |
push: | |
tags: | |
- "*" | |
branches: | |
- "master" | |
permissions: | |
contents: write | |
name: Build | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Build controller | |
run: pio run -e controller | |
- name: Build display | |
run: pio run -e display | |
- name: Rename firmware files | |
run: | | |
mkdir -p out | |
mv .pio/build/controller/firmware.bin out/controller-firmware.bin | |
mv .pio/build/controller/partitions.bin out/controller-partitions.bin | |
mv .pio/build/controller/bootloader.bin out/controller-bootloader.bin | |
mv .pio/build/display/firmware.bin out/display-firmware.bin | |
mv .pio/build/display/partitions.bin out/display-partitions.bin | |
mv .pio/build/display/bootloader.bin out/display-bootloader.bin | |
- name: Archive Firmware Files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gaggimate-firmware | |
path: "out/*.bin" | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Firmware Files | |
uses: actions/download-artifact@v4 | |
with: | |
name: gaggimate-firmware | |
path: release | |
- name: Release Firmware | |
uses: ncipollo/release-action@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
artifacts: release/*.bin | |
generateReleaseNotes: true | |
allowUpdates: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-nightly: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Firmware Files | |
uses: actions/download-artifact@v4 | |
with: | |
name: gaggimate-firmware | |
path: release | |
- name: Build controller | |
run: | | |
ls -lah | |
- name: Update Nightly Release | |
uses: andelf/nightly-release@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: nightly | |
name: 'Nightly Release $$' | |
prerelease: true | |
body: 'Latest nightly release, use the nightly channel in the UI to download this firmware.' | |
files: | | |
release/*.bin |