-
Notifications
You must be signed in to change notification settings - Fork 74
132 lines (114 loc) · 4.99 KB
/
Copy pathrelease.yml
File metadata and controls
132 lines (114 loc) · 4.99 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release Pipeline
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
inputs:
tag_name:
description: 'Enter the name of the tag which to release.'
required: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
jobs:
# The introduction just shows some useful informations.
intro:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "The name of the branch is ${{ github.ref }} and the repository is ${{ github.repository }}."
# Build all targets
build:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
needs: intro
strategy:
matrix:
environment: ["adafruit_feather_esp32_v2-LED-32x8", "adafruit_matrixportal_s3-HUB75-64x64", "az-delivery-devkit-v4-LED-32x8", "esp32doit-devkit-v1-LED-32x8", "esp32doit-devkit-v1-HUB75-64x64", "esp32-s3-devkitc-1-n16r8v-LED-32x8", "esp32-s3-devkitc-1-n16r8v-LED-32x16", "esp32-nodemcu-LED-32x8", "lilygo-ttgo-t-display-TFT-32x8", "lilygo-t-display-s3-TFT-32x8", "lilygo-t-display-s3-TFT-64x16", "m5stack_core-TFT-32x8", "ulanzi-tc001-LED-32x8", "wemos_lolin_s2_mini-LED-32x8"]
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.tag_name }}
- name: Cache pip
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v5
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Create release artifcats folder
run: |
mkdir ${{ github.workspace }}/artifacts
- name: Compile ${{ matrix.environment }} firmware
run: platformio run --environment ${{ matrix.environment }}
- name: Determine factory binary name
id: factory
# Extract board name from environment (remove display suffix like -LED-32x8)
run: |
BOARD_NAME=$(echo "${{ matrix.environment }}" | sed 's/-LED-.*//; s/-HUB75-.*//; s/-TFT-.*//')
FACTORY_BIN="factory_binaries/${BOARD_NAME}-factory.bin"
if [ -f "$FACTORY_BIN" ]; then
echo "factory_bin=$FACTORY_BIN" >> $GITHUB_OUTPUT
echo "Found factory binary: $FACTORY_BIN"
else
echo "factory_bin=" >> $GITHUB_OUTPUT
echo "No factory binary found for: $BOARD_NAME"
fi
- name: Deploy ${{ matrix.environment }} firmware
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.environment }}_firmware
path: |
${{ github.workspace }}/.pio/build/${{ matrix.environment }}/firmware.bin
${{ github.workspace }}/.pio/build/${{ matrix.environment }}/bootloader.bin
${{ github.workspace }}/.pio/build/${{ matrix.environment }}/partitions.bin
${{ github.workspace }}/${{ steps.factory.outputs.factory_bin }}
retention-days: 5
- name: Build ${{ matrix.environment }} filesystem image
run: platformio run --environment ${{ matrix.environment }} --target buildfs
- name: Deploy ${{ matrix.environment }} filesystem image
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.environment }}_filesystem
path: |
${{ github.workspace }}/.pio/build/${{ matrix.environment }}/spiffs.bin
${{ github.workspace }}/.pio/build/${{ matrix.environment }}/littlefs.bin
retention-days: 5
# Deploy release artifacts
deploy:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download release artifacts
uses: actions/download-artifact@v7
with:
path: ${{ github.workspace }}/artifacts
- name: Display structure of release artifacts
run: ls -R
working-directory: ${{ github.workspace }}/artifacts
- name: Zip release artifacts folder
run: zip -r ${{ github.event.repository.name }}-${{ github.event.inputs.tag_name }}.zip .
working-directory: ${{ github.workspace }}/artifacts
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag_name }}
files: ${{ github.workspace }}/artifacts/${{ github.event.repository.name }}-${{ github.event.inputs.tag_name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}