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
58
64
./${{ env.DISTPATH }}/espsecure -h || exit 1
59
65
./${{ env.DISTPATH }}/esp_rfc2217_server -h || exit 1
60
66
61
- # Add license and readme
62
- mv LICENSE README.md ./${{ env.DISTPATH }}
63
-
64
67
- name : Archive artifact
65
- uses : actions/upload-artifact@master
68
+ uses : actions/upload-artifact@v4
66
69
with :
67
70
name : ${{ env.DISTPATH }}
68
71
path : ${{ env.DISTPATH }}
83
86
SEPARATOR : ' :'
84
87
RUN_ON : macos-latest # Versions 14 and higher are ARM-based.
85
88
- platform : windows
86
- TARGET : windows-amd64
89
+ TARGET : win64
87
90
EXTEN : .exe
88
91
SEPARATOR : ' ;'
89
92
RUN_ON : windows-latest
@@ -98,11 +101,16 @@ jobs:
98
101
PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
99
102
steps :
100
103
- name : Checkout repository
101
- uses : actions/checkout@master
104
+ uses : actions/checkout@v4
102
105
- name : Set up Python 3.11
103
- uses : actions/setup-python@master
106
+ uses : actions/setup-python@v5
104
107
with :
105
- python-version : " 3.11"
108
+ python-version : 3.11
109
+ - name : Update esptool version when releasing
110
+ if : startsWith(github.ref, 'refs/tags/')
111
+ run : |
112
+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
113
+ #git diff
106
114
- name : Install dependencies
107
115
run : |
108
116
python -m pip install --upgrade pip
@@ -132,63 +140,74 @@ jobs:
132
140
./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
133
141
./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
134
142
./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h
135
- - name : Add license and readme
136
- shell : bash
137
- run : mv LICENSE README.md ./${{ env.DISTPATH }}
138
143
- name : Archive artifact
139
- uses : actions/upload-artifact@master
144
+ uses : actions/upload-artifact@v4
140
145
with :
141
146
name : ${{ env.DISTPATH }}
142
147
path : ${{ env.DISTPATH }}
148
+ - name : Update package.json when a release tag is set
149
+ if : startsWith(github.ref, 'refs/tags/') && matrix.platform == 'linux-amd64'
150
+ run : |
151
+ rm -f package.json
152
+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
153
+ - name : Upload package.json artifact
154
+ if : startsWith(github.ref, 'refs/tags/') && matrix.platform == 'linux-amd64'
155
+ uses : actions/upload-artifact@v4
156
+ with :
157
+ name : manifest
158
+ path : /home/runner/work/esptool/esptool/package.json
143
159
144
- create_release :
145
- name : Create GitHub release
146
- if : startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev'))
147
- needs : [build-esptool-binaries, build-esptool-binaries-arm]
160
+ push_stubs :
161
+ name : Commit changed package.json
162
+ needs : build-esptool-binaries
148
163
runs-on : ubuntu-latest
149
- env :
150
- PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
151
- permissions :
152
- contents : write
153
164
steps :
154
- - name : Get version
155
- id : get_version
156
- run : echo "VERSION=${GITHUB_REF# refs/tags/v}" >> $GITHUB_OUTPUT
157
- shell : bash
158
- - name : Checkout
159
- uses : actions/checkout@master
165
+ - name : Checkout repository
166
+ uses : actions/checkout@v4
167
+ if : startsWith(github.ref, ' refs/tags/')
168
+ - name : Download artifacts
169
+ uses : actions/download-artifact@v4
170
+ if : startsWith(github.ref, 'refs/tags/')
160
171
with :
161
- fetch-depth : 0
162
- - name : Install dependencies
163
- run : |
164
- python -m pip install --upgrade pip
165
- pip install --user -e ".[dev]"
166
- - name : Generate changelog
167
- run : |
168
- cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md
169
- cat changelog_body.md
170
- - name : Download built binaries
171
- uses : actions/download-artifact@master
172
- - name : Compress and rename binaries
173
- run : |
174
- for dir in esptool-*; do
175
- if [[ "$dir" == esptool-win* ]]; then
176
- zip -r "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.zip" "$dir"
177
- else
178
- chmod -R u=rwx,g=rx,o=rx "$dir"
179
- tar -cvzf "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.tar.gz" "$dir"
180
- fi
181
- done
182
- - name : Create release
183
- id : create_release
184
- uses : softprops/action-gh-release@v1
185
- env :
186
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
172
+ name : |
173
+ manifest
174
+ path : |
175
+ ./
176
+ - uses : stefanzweifel/git-auto-commit-action@v5
177
+ if : startsWith(github.ref, 'refs/tags/')
187
178
with :
188
- body_path : changelog_body.md
189
- name : Version ${{ steps.get_version.outputs.VERSION }}
190
- draft : true
191
- prerelease : false
192
- files : |
193
- esptool-v${{ steps.get_version.outputs.VERSION }}-*.zip
194
- esptool-v${{ steps.get_version.outputs.VERSION }}-*.tar.gz
179
+ commit_message : update manifest
180
+
181
+ release :
182
+ name : Upload release binaries
183
+ needs : [build-esptool-binaries, build-esptool-binaries-arm, push_stubs]
184
+ if : startsWith(github.ref, 'refs/tags/')
185
+ runs-on : ubuntu-latest
186
+ steps :
187
+ - name : Checkout repository
188
+ uses : actions/checkout@v4
189
+ - name : Zip esptool.py
190
+ run : |
191
+ echo "Packaging new esptool release: ${{ github.ref_name }}"
192
+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
193
+ rm package.json
194
+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
195
+ python ci/pack_python.py
196
+ - name : Download built binaries
197
+ uses : actions/download-artifact@v4
198
+ - name : Rename and package binaries
199
+ run : |
200
+ zip -r esptool-armv7.zip ./esptool-armv7
201
+ zip -r esptool-aarch64.zip ./esptool-aarch64
202
+ zip -r esptool-macos-arm64.zip ./esptool-macos-arm64
203
+ zip -r esptool-macos-amd64.zip ./esptool-macos-amd64
204
+ zip -r esptool-linux-amd64.zip ./esptool-linux-amd64
205
+ zip -r esptool-win64.zip ./esptool-win64
206
+ - name : Release
207
+
208
+ with :
209
+ prerelease : false
210
+ files : |
211
+ *.zip
212
+ env :
213
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments