11name : Build esptool
22
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
410
511jobs :
612 build-esptool-binaries-arm :
@@ -10,13 +16,13 @@ jobs:
1016 matrix :
1117 platform : [armv7, aarch64]
1218 env :
13- DISTPATH : esptool-linux- ${{ matrix.platform }}
19+ DISTPATH : esptool-${{ matrix.platform }}
1420 STUBS_DIR : ./esptool/targets/stub_flasher/
1521 EFUSE_DIR : ./espefuse/efuse_defs/
1622 PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
1723 steps :
1824 - name : Checkout repository
19- uses : actions/checkout@master
25+ uses : actions/checkout@v4
2026 - uses : uraimo/run-on-arch-action@v2
2127 name : Build and test in ${{ matrix.platform }}
2228 with :
3541 add-apt-repository -y ppa:deadsnakes/ppa
3642 apt-get update -y
3743 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
3945 run : |
4046 python3.11 -m pip install --upgrade cffi
4147 adduser --disabled-password --gecos "" builder
6672 ./${{ env.DISTPATH }}/espsecure -h || exit 1
6773 ./${{ env.DISTPATH }}/esp_rfc2217_server -h || exit 1
6874
69- # Add license and readme
70- mv LICENSE README.md ./${{ env.DISTPATH }}
71-
7275 - name : Archive artifact
73- uses : actions/upload-artifact@master
76+ uses : actions/upload-artifact@v4
7477 with :
7578 name : ${{ env.DISTPATH }}
7679 path : ${{ env.DISTPATH }}
9194 SEPARATOR : ' :'
9295 RUN_ON : macos-latest # Versions 14 and higher are ARM-based.
9396 - platform : windows
94- TARGET : windows-amd64
97+ TARGET : win64
9598 EXTEN : .exe
9699 SEPARATOR : ' ;'
97100 RUN_ON : windows-latest
@@ -106,11 +109,16 @@ jobs:
106109 PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
107110 steps :
108111 - name : Checkout repository
109- uses : actions/checkout@master
112+ uses : actions/checkout@v4
110113 - name : Set up Python 3.11
111- uses : actions/setup-python@master
114+ uses : actions/setup-python@v5
112115 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
114122 - name : Install dependencies
115123 run : |
116124 python -m pip install --upgrade pip
@@ -146,63 +154,76 @@ jobs:
146154 ./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
147155 ./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
148156 ./${{ 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 }}
152157 - name : Archive artifact
153- uses : actions/upload-artifact@master
158+ uses : actions/upload-artifact@v4
154159 with :
155160 name : ${{ env.DISTPATH }}
156161 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
157173
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
162177 runs-on : ubuntu-latest
163- env :
164- PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
165- permissions :
166- contents : write
167178 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
174181 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/')
201194 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+ 224+ with :
225+ prerelease : false
226+ files : |
227+ *.zip
228+ env :
229+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments