Skip to content
name: Build and Release Firmware
on:
push:
tags:
- '*' # Triggers on any tag
pull_request:
branches:
- main # Trigger on PRs to the main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker image
run: cd AxxSolder_firmware && docker build -t firmware-builder -f Containerfile .
- name: Set firmware path
run: echo "FIRMWARE_PATH=AxxSolder-${GITHUB_REF#refs/tags/}.bin" >> $GITHUB_ENV
- name: Run firmware build and copy artifact
if: startsWith(github.ref, 'refs/tags/')
run: |
cd AxxSolder_firmware
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
firmware-builder \
cp /app/build/AxxSolder.bin /workspace/${FIRMWARE_PATH}
- name: Upload firmware artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: firmware
path: ${{ env.FIRMWARE_PATH }}
release:
needs: build
if: startsWith(github.ref, 'refs/tags/') #will only run on tags, never on PRs
runs-on: ubuntu-latest
steps:
- name: Download firmware artifact
uses: actions/download-artifact@v4
with:
name: firmware
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: ${{ github.workspace }}/*.bin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}