1
1
name : Build esptool
2
2
3
- on : [push, pull_request]
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ tags :
7
+ - " v*.*.*"
8
+ paths-ignore :
9
+ - ' .github/**' # Ignore changes towards the .github directory
4
10
5
11
jobs :
6
12
build-esptool-binaries-arm :
@@ -10,13 +16,13 @@ jobs:
10
16
matrix :
11
17
platform : [armv7, aarch64]
12
18
env :
13
- DISTPATH : esptool-linux- ${{ matrix.platform }}
19
+ DISTPATH : esptool-${{ matrix.platform }}
14
20
STUBS_DIR : ./esptool/targets/stub_flasher/
15
21
EFUSE_DIR : ./espefuse/efuse_defs/
16
22
PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
17
23
steps :
18
24
- name : Checkout repository
19
- uses : actions/checkout@master
25
+ uses : actions/checkout@v4
20
26
- uses : uraimo/run-on-arch-action@v2
21
27
name : Build and test in ${{ matrix.platform }}
22
28
with :
35
41
add-apt-repository -y ppa:deadsnakes/ppa
36
42
apt-get update -y
37
43
apt-get install --ignore-missing -y python3.11 python3.11-dev python3-pip pkg-config openssl libffi-dev libssl-dev cargo rustc
38
- python3.11 -m pip install --upgrade pip setuptools wheel
44
+ python3.11 -m pip install --upgrade pip setuptools==74.1.3 wheel
39
45
run : |
40
46
python3.11 -m pip install --upgrade cffi
41
47
adduser --disabled-password --gecos "" builder
66
72
./${{ env.DISTPATH }}/espsecure -h || exit 1
67
73
./${{ env.DISTPATH }}/esp_rfc2217_server -h || exit 1
68
74
69
- # Add license and readme
70
- mv LICENSE README.md ./${{ env.DISTPATH }}
71
-
72
75
- name : Archive artifact
73
- uses : actions/upload-artifact@master
76
+ uses : actions/upload-artifact@v4
74
77
with :
75
78
name : ${{ env.DISTPATH }}
76
79
path : ${{ env.DISTPATH }}
91
94
SEPARATOR : ' :'
92
95
RUN_ON : macos-latest # Versions 14 and higher are ARM-based.
93
96
- platform : windows
94
- TARGET : windows-amd64
97
+ TARGET : win64
95
98
EXTEN : .exe
96
99
SEPARATOR : ' ;'
97
100
RUN_ON : windows-latest
@@ -106,11 +109,16 @@ jobs:
106
109
PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
107
110
steps :
108
111
- name : Checkout repository
109
- uses : actions/checkout@master
112
+ uses : actions/checkout@v4
110
113
- name : Set up Python 3.11
111
- uses : actions/setup-python@master
114
+ uses : actions/setup-python@v5
112
115
with :
113
- python-version : " 3.11"
116
+ python-version : 3.11
117
+ - name : Update esptool version when releasing
118
+ if : startsWith(github.ref, 'refs/tags/')
119
+ run : |
120
+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
121
+ #git diff
114
122
- name : Install dependencies
115
123
run : |
116
124
python -m pip install --upgrade pip
@@ -146,63 +154,76 @@ jobs:
146
154
./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
147
155
./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
148
156
./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h
149
- - name : Add license and readme
150
- shell : bash
151
- run : mv LICENSE README.md ./${{ env.DISTPATH }}
152
157
- name : Archive artifact
153
- uses : actions/upload-artifact@master
158
+ uses : actions/upload-artifact@v4
154
159
with :
155
160
name : ${{ env.DISTPATH }}
156
161
path : ${{ env.DISTPATH }}
162
+ - name : Update package.json when a release tag is set
163
+ if : startsWith(github.ref, 'refs/tags/') && matrix.platform == 'linux-amd64'
164
+ run : |
165
+ rm -f package.json
166
+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
167
+ - name : Upload package.json artifact
168
+ if : startsWith(github.ref, 'refs/tags/') && matrix.platform == 'linux-amd64'
169
+ uses : actions/upload-artifact@v4
170
+ with :
171
+ name : manifest
172
+ path : /home/runner/work/esptool/esptool/package.json
157
173
158
- create_release :
159
- name : Create GitHub release
160
- if : startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev'))
161
- needs : [build-esptool-binaries, build-esptool-binaries-arm]
174
+ push_stubs :
175
+ name : Commit changed package.json
176
+ needs : build-esptool-binaries
162
177
runs-on : ubuntu-latest
163
- env :
164
- PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
165
- permissions :
166
- contents : write
167
178
steps :
168
- - name : Get version
169
- id : get_version
170
- run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
171
- shell : bash
172
- - name : Checkout
173
- uses : actions/checkout@master
179
+ - name : Checkout repository
180
+ uses : actions/checkout@v4
174
181
with :
175
- fetch-depth : 0
176
- - name : Install dependencies
177
- run : |
178
- python -m pip install --upgrade pip
179
- pip install --user -e ".[dev]"
180
- - name : Generate changelog
181
- run : |
182
- cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md
183
- cat changelog_body.md
184
- - name : Download built binaries
185
- uses : actions/download-artifact@master
186
- - name : Compress and rename binaries
187
- run : |
188
- for dir in esptool-*; do
189
- if [[ "$dir" == esptool-win* ]]; then
190
- zip -r "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.zip" "$dir"
191
- else
192
- chmod -R u=rwx,g=rx,o=rx "$dir"
193
- tar -cvzf "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.tar.gz" "$dir"
194
- fi
195
- done
196
- - name : Create release
197
- id : create_release
198
- uses : softprops/action-gh-release@v1
199
- env :
200
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
182
+ ref : master_pio
183
+ if : startsWith(github.ref, 'refs/tags/')
184
+ - name : Download artifacts
185
+ uses : actions/download-artifact@v4
186
+ if : startsWith(github.ref, 'refs/tags/')
187
+ with :
188
+ name : |
189
+ manifest
190
+ path : |
191
+ ./
192
+ - uses : stefanzweifel/git-auto-commit-action@v5
193
+ if : startsWith(github.ref, 'refs/tags/')
201
194
with :
202
- body_path : changelog_body.md
203
- name : Version ${{ steps.get_version.outputs.VERSION }}
204
- draft : true
205
- prerelease : false
206
- files : |
207
- esptool-v${{ steps.get_version.outputs.VERSION }}-*.zip
208
- esptool-v${{ steps.get_version.outputs.VERSION }}-*.tar.gz
195
+ commit_message : update manifest
196
+
197
+ release :
198
+ name : Upload release binaries
199
+ needs : [build-esptool-binaries, build-esptool-binaries-arm, push_stubs]
200
+ if : startsWith(github.ref, 'refs/tags/')
201
+ runs-on : ubuntu-latest
202
+ steps :
203
+ - name : Checkout repository
204
+ uses : actions/checkout@v4
205
+ - name : Zip esptool.py
206
+ run : |
207
+ echo "Packaging new esptool release: ${{ github.ref_name }}"
208
+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
209
+ rm package.json
210
+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
211
+ python ci/pack_python.py
212
+ - name : Download built binaries
213
+ uses : actions/download-artifact@v4
214
+ - name : Rename and package binaries
215
+ run : |
216
+ zip -r esptool-armv7.zip ./esptool-armv7
217
+ zip -r esptool-aarch64.zip ./esptool-aarch64
218
+ zip -r esptool-macos-arm64.zip ./esptool-macos-arm64
219
+ zip -r esptool-macos-amd64.zip ./esptool-macos-amd64
220
+ zip -r esptool-linux-amd64.zip ./esptool-linux-amd64
221
+ zip -r esptool-win64.zip ./esptool-win64
222
+ - name : Release
223
+ uses : jason2866/action-gh-release@v1.3
224
+ with :
225
+ prerelease : false
226
+ files : |
227
+ *.zip
228
+ env :
229
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments