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 :
7- name : Build esptool binaries for ${{ matrix.platform }}
8- runs-on : ${{ matrix.RUN_ON }}
13+ name : Build esptool binaries for ${{ matrix.os }}
14+ runs-on : ${{ matrix.os }}
915 strategy :
1016 matrix :
11- platform : [macos, windows, linux-amd64, linux-arm32, linux-arm64 ]
17+ os : [macos-14, macos-13, ubuntu-latest, windows-latest ]
1218 include :
13- - platform : macos
19+ - os : macos-14
20+ TARGET : macos-arm
21+ SEPARATOR : ' :'
22+ - os : macos-13
1423 TARGET : macos
1524 SEPARATOR : ' :'
16- RUN_ON : macos-latest
17- - platform : windows
25+ - os : ubuntu-latest
26+ TARGET : linux-amd64
27+ SEPARATOR : ' :'
28+ - os : windows-latest
1829 TARGET : win64
1930 EXTEN : .exe
2031 SEPARATOR : ' ;'
21- RUN_ON : windows-latest
22- - platform : linux-amd64
23- TARGET : linux-amd64
24- SEPARATOR : ' :'
25- RUN_ON : ubuntu-20.04
26- - platform : linux-arm32
27- CONTAINER : python:3.8-bullseye
28- TARGET : linux-arm32
29- SEPARATOR : ' :'
30- RUN_ON : [ARM, self-hosted, linux, docker]
31- - platform : linux-arm64
32- CONTAINER : python:3.8-bullseye
33- TARGET : linux-arm64
34- SEPARATOR : ' :'
35- RUN_ON : [ARM64, self-hosted, linux]
36- container : ${{ matrix.CONTAINER }} # use python container on ARM
3732 env :
3833 DISTPATH : esptool-${{ matrix.TARGET }}
3934 STUBS_DIR : ./esptool/targets/stub_flasher/
4035 EFUSE_DIR : ./espefuse/efuse_defs/
4136 PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
4237 steps :
4338 - name : Checkout repository
44- uses : actions/checkout@master
45- - name : Set up Python 3.8
46- # Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
47- if : matrix.platform != 'linux-arm32' && matrix.platform != 'linux-arm64'
48- uses : actions/setup-python@master
39+ uses : actions/checkout@v4
40+ - name : Set up Python 3.11
41+ uses : actions/setup-python@v5
4942 with :
50- python-version : 3.8
43+ python-version : 3.11
44+ - name : Update esptool version when releasing
45+ if : startsWith(github.ref, 'refs/tags/')
46+ run : |
47+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
48+ #git diff
5149 - name : Install dependencies
5250 # PyInstaller >=6.0 results in significantly more antivirus false positives
5351 run : |
@@ -60,74 +58,78 @@ jobs:
6058 pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml${{ matrix.SEPARATOR }}${{ env.EFUSE_DIR }}" espefuse.py
6159 pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py
6260 pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico esp_rfc2217_server.py
63- - name : Sign binaries
64- if : matrix.platform == 'windows' && github.event_name != 'pull_request'
65- env :
66- CERTIFICATE : ${{ secrets.CERTIFICATE }}
67- CERTIFICATE_PASSWORD : ${{ secrets.CERTIFICATE_PASSWORD }}
68- shell : pwsh
69- run : |
70- ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esptool.exe
71- ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espefuse.exe
72- ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espsecure.exe
73- ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esp_rfc2217_server.exe
7461 - name : Test binaries
7562 shell : bash
7663 run : |
7764 ./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h
7865 ./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
7966 ./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
8067 ./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h
81- - name : Add license and readme
82- shell : bash
83- run : mv LICENSE README.md ./${{ env.DISTPATH }}
8468 - name : Archive artifact
8569 uses : actions/upload-artifact@master
8670 with :
8771 name : ${{ env.DISTPATH }}
8872 path : ${{ env.DISTPATH }}
73+ - name : Update package.json when a release tag is set
74+ if : startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
75+ run : |
76+ rm package.json
77+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
78+ - name : Upload package.json artifact
79+ if : matrix.os == 'ubuntu-latest'
80+ 81+ with :
82+ name : manifest
83+ path : /home/runner/work/esptool/esptool/package.json
8984
90- create_release :
91- name : Create GitHub release
92- if : startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev'))
85+ push_stubs :
86+ name : Commit changed package.json
9387 needs : build-esptool-binaries
9488 runs-on : ubuntu-latest
95- env :
96- PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
97- permissions :
98- contents : write
9989 steps :
100- - name : Get version
101- id : get_version
102- run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
103- shell : bash
104- - name : Checkout
105- uses : actions/checkout@master
90+ - name : Checkout repository
91+ uses : actions/checkout@v4
92+ - name : Download artifacts
93+ 10694 with :
107- fetch-depth : 0
108- - name : Install dependencies
109- run : |
110- python -m pip install --upgrade pip
111- pip install --user -e ".[dev]"
112- - name : Generate changelog
113- run : |
114- cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md
115- cat changelog_body.md
116- - name : Download built binaries
117- uses : actions/download-artifact@master
118- - name : Compress and rename binaries
119- run : |
120- for dir in esptool-*; do
121- zip -r "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.zip" "$dir"
122- done
123- - name : Create release
124- id : create_release
125- uses : softprops/action-gh-release@v1
126- env :
127- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
95+ name : |
96+ manifest
97+ path : |
98+ ./
99+ - uses : stefanzweifel/git-auto-commit-action@v5
128100 with :
129- body_path : changelog_body.md
130- name : Version ${{ steps.get_version.outputs.VERSION }}
131- draft : true
132- prerelease : false
133- files : esptool-v${{ steps.get_version.outputs.VERSION }}-*.zip
101+ commit_message : update manifest
102+
103+ release :
104+ name : Upload release binaries
105+ needs : build-esptool-binaries
106+ if : startsWith(github.ref, 'refs/tags/')
107+ runs-on : ubuntu-latest
108+ steps :
109+ - name : Checkout repository
110+ uses : actions/checkout@v4
111+ with :
112+ ref : main_work
113+ - name : Zip esptool.py
114+ run : |
115+ echo "Packaging new esptool release: ${{ github.ref_name }}"
116+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
117+ rm package.json
118+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
119+ python ci/pack_python.py
120+ - name : Download built binaries
121+ uses : actions/download-artifact@master
122+ - name : Rename and package binaries
123+ run : |
124+ zip -r esptool-macos-arm.zip ./esptool-macos-arm
125+ zip -r esptool-macos.zip ./esptool-macos
126+ zip -r esptool-linux-amd64.zip ./esptool-linux-amd64
127+ zip -r esptool-win64.zip ./esptool-win64
128+ - name : Release
129+ 130+ with :
131+ prerelease : false
132+ files : |
133+ *.zip
134+ env :
135+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments