-
Notifications
You must be signed in to change notification settings - Fork 124
134 lines (125 loc) · 4.15 KB
/
build.yml
File metadata and controls
134 lines (125 loc) · 4.15 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
133
134
name: Build Firmware
on:
pull_request:
branches:
- main
paths:
- 'ats-mini/**'
- '.github/workflows/build.yml'
push:
# tags:
# - 'v*'
# branches:
# - main
paths:
- 'ats-mini/**'
- '.github/workflows/build.yml'
workflow_dispatch:
inputs:
revision:
description: "A tag to release, e.g. v1.00"
type: string
required: false
jobs:
build:
runs-on: ubuntu-latest
permissions: {}
strategy:
fail-fast: true
outputs:
slug: ${{ steps.slug.outputs.slug }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: "${{ github.event.inputs.revision || github.ref }}"
- name: Get version slug
id: slug
run: |
echo "slug=$(git describe --tags --match 'v?.??' --always --dirty || echo v0.00)" >> $GITHUB_OUTPUT
- name: Compile firmware
uses: arduino/compile-sketches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sketch-paths: |
- ats-mini
fqbn: esp32:esp32:esp32s3
platforms: |
- name: esp32:esp32
libraries: |
- name: "PU2CLR SI4735"
- name: TFT_eSPI
cli-compile-flags: |
- --export-binaries
- --board-options
- CDCOnBoot=cdc
- --board-options
- FlashSize=8M
- --board-options
- PSRAM=disabled
- --board-options
- CPUFreq=80
- --board-options
- USBMode=hwcdc
- --board-options
- FlashMode=qio
- --board-options
- PartitionScheme=default_8MB
- --board-options
- DebugLevel=none
- --warnings
- none
enable-deltas-report: true
enable-warnings-report: true
- name: Save sketches report artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: sketches-reports
name: sketches-report
- name: Prepare compiled artifact
run: |
mkdir -p artifact/ats-mini
mv ats-mini/build/esp32.esp32.esp32s3/*.ino.bin ats-mini/build/esp32.esp32.esp32s3/*.ino.*.bin artifact/ats-mini/
cp CHANGELOG.md artifact/ats-mini/
- name: Upload compiled artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ github.event.repository.name }}-${{ steps.slug.outputs.slug }}
path: artifact
release:
if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))) }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: true
steps:
- name: Download the build artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ needs.build.outputs.slug }}
path: artifact
- name: Archive the build artifact
run: cd "artifact" && zip -9 -r "../${FILENAME}" *
env:
FILENAME: ${{ github.event.repository.name }}-${{ needs.build.outputs.slug }}.zip
- name: Create release
env:
GITHUB_TOKEN: ${{ github.token }}
SLUG: ${{ needs.build.outputs.slug }}
run: >-
cat artifact/ats-mini/CHANGELOG.md |
python -c 'import os,re,sys; t=sys.stdin.read(); r=re.search(f"""(^## {os.environ["SLUG"][1:].replace(".", "\\.")} .*?)(?=^## \\d|\\Z)""", t, re.MULTILINE | re.DOTALL); print(r.group(0) if r else "")' |
gh release create "$SLUG" --repo '${{ github.repository }}' --notes-file -
- name: Upload release artifact
env:
GITHUB_TOKEN: ${{ github.token }}
FILENAME: ${{ github.event.repository.name }}-${{ needs.build.outputs.slug }}.zip
SLUG: ${{ needs.build.outputs.slug }}
run: |
gh release upload "$SLUG" "$FILENAME" --repo '${{ github.repository }}' --clobber