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 :
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 }}
9
15
strategy :
10
16
matrix :
11
- platform : [macos, windows, linux-amd64, linux-arm32, linux-arm64 ]
17
+ os : [macos-14, macos-latest, ubuntu-latest, windows-latest ]
12
18
include :
13
- - platform : macos
19
+ - os : macos-14
20
+ TARGET : macos-arm
21
+ SEPARATOR : ' :'
22
+ - os : macos-latest
14
23
TARGET : macos
15
24
SEPARATOR : ' :'
16
- RUN_ON : macos-latest
17
- - platform : windows
25
+ - os : ubuntu-latest
26
+ TARGET : linux-amd64
27
+ SEPARATOR : ' :'
28
+ - os : windows-latest
18
29
TARGET : win64
19
30
EXTEN : .exe
20
31
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]
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
37
32
env :
38
33
DISTPATH : esptool-${{ matrix.TARGET }}
39
34
STUBS_DIR : ./esptool/targets/stub_flasher/
40
35
EFUSE_DIR : ./espefuse/efuse_defs/
41
36
PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
42
37
steps :
43
38
- 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
+ with :
41
+ ref : main_work
42
+ - name : Set up Python 3.11
43
+ uses : actions/setup-python@v5
49
44
with :
50
- python-version : 3.8
45
+ python-version : 3.11
46
+ - name : Update esptool version when releasing
47
+ if : startsWith(github.ref, 'refs/tags/')
48
+ run : |
49
+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
50
+ #git diff
51
51
- name : Install dependencies
52
52
# PyInstaller >=6.0 results in significantly more antivirus false positives
53
53
run : |
@@ -60,72 +60,102 @@ jobs:
60
60
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml${{ matrix.SEPARATOR }}${{ env.EFUSE_DIR }}" espefuse.py
61
61
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py
62
62
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
74
63
- name : Test binaries
75
64
shell : bash
76
65
run : |
77
66
./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h
78
67
./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
79
68
./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
80
69
./${{ 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 }}
84
70
- name : Archive artifact
85
71
uses : actions/upload-artifact@master
86
72
with :
87
73
name : ${{ env.DISTPATH }}
88
74
path : ${{ env.DISTPATH }}
75
+ - name : Build stub
76
+ if : matrix.os == 'ubuntu-latest'
77
+ run : |
78
+ export TOOLCHAIN_DIR=$HOME/toolchain
79
+ export ESP8266_BINDIR=$TOOLCHAIN_DIR/xtensa-lx106-elf/bin
80
+ export ESP32_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32-elf/bin
81
+ export ESP32S2_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s2-elf/bin
82
+ export ESP32S3_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s3-elf/bin
83
+ export ESP32C3_BINDIR=$TOOLCHAIN_DIR/riscv32-esp-elf/bin
84
+ export PATH=$PATH:$ESP8266_BINDIR:$ESP32_BINDIR:$ESP32S2_BINDIR:$ESP32S3_BINDIR:$ESP32C3_BINDIR
85
+ ./ci/setup_ci_build_env.sh
86
+ make -C flasher_stub V=1
87
+ rm /home/runner/work/esptool/esptool/flasher_stub/build/*.elf
88
+ rm /home/runner/work/esptool/esptool/flasher_stub/build/*.map
89
+ - name : Update package.json when a release tag is set
90
+ if : startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
91
+ run : |
92
+ rm package.json
93
+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
94
+ - name : Upload stubs artifact
95
+ if : matrix.os == 'ubuntu-latest'
96
+
97
+ with :
98
+ name : stubs
99
+ path : /home/runner/work/esptool/esptool/flasher_stub/build
100
+ - name : Upload package.json artifact
101
+ if : matrix.os == 'ubuntu-latest'
102
+
103
+ with :
104
+ name : manifest
105
+ path : /home/runner/work/esptool/esptool/package.json
89
106
90
- create_release :
91
- name : Create GitHub release
92
- if : startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev'))
107
+ push_stubs :
108
+ name : Commit changed files
93
109
needs : build-esptool-binaries
94
110
runs-on : ubuntu-latest
95
- permissions :
96
- contents : write
97
111
steps :
98
- - name : Get version
99
- id : get_version
100
- run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
101
- shell : bash
102
- - name : Checkout
103
- uses : actions/checkout@master
112
+ - name : Checkout repository
113
+ uses : actions/checkout@v4
104
114
with :
105
- fetch-depth : 0
106
- - name : Install dependencies
107
- run : |
108
- python -m pip install --upgrade pip
109
- pip install --user -e ".[dev]"
110
- - name : Generate changelog
111
- run : |
112
- cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md
113
- cat changelog_body.md
114
- - name : Download built binaries
115
- uses : actions/download-artifact@master
116
- - name : Compress and rename binaries
117
- run : |
118
- for dir in esptool-*; do
119
- zip -r "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.zip" "$dir"
120
- done
121
- - name : Create release
122
- id : create_release
123
- uses : softprops/action-gh-release@v1
124
- env :
125
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
115
+ ref : main_work
116
+ - name : Download artifacts
117
+
118
+ with :
119
+ name : |
120
+ stubs
121
+ manifest
122
+ path : |
123
+ ./esptool/targets/stub_flasher
124
+ ./
125
+ - uses : stefanzweifel/git-auto-commit-action@v5
126
126
with :
127
- body_path : changelog_body.md
128
- name : Version ${{ steps.get_version.outputs.VERSION }}
129
- draft : true
130
- prerelease : false
131
- files : esptool-v${{ steps.get_version.outputs.VERSION }}-*.zip
127
+ commit_message : updated files
128
+
129
+ release :
130
+ name : Upload release binaries
131
+ needs : build-esptool-binaries
132
+ if : startsWith(github.ref, 'refs/tags/')
133
+ runs-on : ubuntu-latest
134
+ steps :
135
+ - name : Checkout repository
136
+ uses : actions/checkout@v4
137
+ with :
138
+ ref : main_work
139
+ - name : Zip esptool.py
140
+ run : |
141
+ echo "Packaging new esptool release: ${{ github.ref_name }}"
142
+ python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py
143
+ rm package.json
144
+ python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }}
145
+ python ci/pack_python.py
146
+ - name : Download built binaries
147
+ uses : actions/download-artifact@master
148
+ - name : Rename and package binaries
149
+ run : |
150
+ zip -r esptool-macos-arm.zip ./esptool-macos-arm
151
+ zip -r esptool-macos.zip ./esptool-macos
152
+ zip -r esptool-linux-amd64.zip ./esptool-linux-amd64
153
+ zip -r esptool-win64.zip ./esptool-win64
154
+ - name : Release
155
+
156
+ with :
157
+ prerelease : false
158
+ files : |
159
+ *.zip
160
+ env :
161
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments