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-13, ubuntu-latest, windows-latest ]
12
18
include :
13
- - platform : macos
19
+ - os : macos-14
20
+ TARGET : macos-arm
21
+ SEPARATOR : ' :'
22
+ - os : macos-13
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, 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
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
+ - name : Set up Python 3.11
41
+ uses : actions/setup-python@v5
49
42
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
51
49
- name : Install dependencies
52
50
# PyInstaller >=6.0 results in significantly more antivirus false positives
53
51
run : |
@@ -60,74 +58,78 @@ jobs:
60
58
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml${{ matrix.SEPARATOR }}${{ env.EFUSE_DIR }}" espefuse.py
61
59
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py
62
60
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
61
- name : Test binaries
75
62
shell : bash
76
63
run : |
77
64
./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h
78
65
./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
79
66
./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
80
67
./${{ 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
68
- name : Archive artifact
85
69
uses : actions/upload-artifact@master
86
70
with :
87
71
name : ${{ env.DISTPATH }}
88
72
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
89
84
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
93
87
needs : build-esptool-binaries
94
88
runs-on : ubuntu-latest
95
- env :
96
- PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
97
- permissions :
98
- contents : write
99
89
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
+
106
94
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
128
100
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