-
Notifications
You must be signed in to change notification settings - Fork 5
81 lines (71 loc) · 2.37 KB
/
firmware.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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: Set GDOOR_VERSION environment variable
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION=${GITHUB_REF#refs/heads/}
fi
SHORT_SHA=$(git rev-parse --short HEAD)
GDOOR_VERSION=${VERSION}+${SHORT_SHA}
echo "GDOOR_VERSION=${GDOOR_VERSION}" >> $GITHUB_ENV
echo GDOOR_VERSION=${GDOOR_VERSION}
- 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
release:
if: startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '-hardware')
runs-on: ubuntu-latest
needs: build
steps:
- name: Download production artifacts
uses: actions/download-artifact@v4
with:
name: gdoor_firmware
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: "Firmware ${GITHUB_REF#refs/tags/}"
files: ./*.bin
- name: Push firmware to website repo for web installer
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: './web'
target-directory: 'assets/firmware'
destination-github-username: 'gdoor-org'
destination-repository-name: 'gdoor-org.github.io'
target-branch: main
user-name: 'github-actions[bot]'
commit-message: 'Latest firmware for web installer via ORIGIN_COMMIT'