Skip to content

CI: push firmware to website repo #27

CI: push firmware to website repo

CI: push firmware to website repo #27

Workflow file for this run

name: PlatformIO CI
on:
push:
paths: # only run if firmware changes
- 'firmware/**'
- '.github/workflows/firmware.yml'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./firmware/esp32/gdoor
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Declare version variable
shell: bash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
echo "GDOOR_VERSION=\"$(echo ${BRANCH}) ($(echo ${SHA_SHORT}))\"" >> "$GITHUB_ENV"
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Build PlatformIO Project
run: pio run
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: gdoor_firmware
path: |
./firmware/esp32/gdoor/.pio/build/GDOOR_ESP32MINI/*.bin
./firmware/esp32/gdoor/.pio/build/GDOOR_ESP32MINI/web
# on main branch: push firmware to web flasher
- name: Push firmware to website repo for web flasher
if: github.ref == 'refs/heads/main'
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: './firmware/esp32/gdoor/.pio/build/GDOOR_ESP32MINI/web'
target-directory: 'assets/firmware'
destination-repository-name: 'gdoor-org.github.io'
target-branch: main
user-name: 'github-actions[bot]'
commit-message: 'Latest firmware for web flasher via ORIGIN_COMMIT'