-
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (105 loc) · 3.03 KB
/
build-release.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
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
name: build-release
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
on:
workflow_dispatch:
inputs:
release-version:
type: string
description: Firmware Version
default: 'vX.X.X'
required: true
release-type:
type: choice
description: Production or Development?
options:
- 'production'
- 'development'
- 'build only'
default: 'development'
pull_request:
jobs:
build-esp32s3:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache pip and platformio
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO
run: pip install --upgrade platformio
- name: Set version var
run: echo "PLATFORMIO_BUILD_FLAGS=-DFW_VERSION='\"${{ inputs.release-version }}\"' -DREPO_PATH='\"$GITHUB_REPOSITORY\"'" >> $GITHUB_ENV
if: github.event_name == 'workflow_dispatch'
- name: Setup git for private libraries
run: gh auth setup-git
- name: Run PlatformIO
run: pio run -e esp32-s3-devkitc-1
- name: Rename firmware
run: cp .pio/build/esp32-s3-devkitc-1/firmware.bin esp32s3.bin
- name: Cache Build
if: github.event_name == 'workflow_dispatch'
uses: actions/cache@v3
with:
path: 'esp32s3.bin'
key: ${{ runner.os }}-${{ github.run_id }}
archive-esp32s3:
needs: build-esp32s3
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get Cached Build
if: github.event_name == 'workflow_dispatch'
uses: actions/cache@v3
with:
path: 'esp32s3.bin'
key: ${{ runner.os }}-${{ github.run_id }}
- name: Archive Build
uses: actions/upload-artifact@v3
with:
name: 'build'
path: 'esp32s3.bin'
release:
needs:
- build-esp32s3
if: (github.event_name == 'workflow_dispatch' && inputs.release-type != 'build only')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get Cached Build
if: github.event_name == 'workflow_dispatch'
uses: actions/cache@v3
with:
path: 'esp32s3.bin'
key: ${{ runner.os }}-${{ github.run_id }}
- name: Development Release
uses: ncipollo/release-action@v1
if: inputs.release-type == 'development'
with:
artifacts: '*.bin'
generateReleaseNotes: true
tag: ${{ inputs.release-version }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
makeLatest: false
- name: Production Release
uses: ncipollo/release-action@v1
if: inputs.release-type == 'production'
with:
artifacts: '*.bin'
generateReleaseNotes: true
tag: ${{ inputs.release-version }}
token: ${{ secrets.GITHUB_TOKEN }}