|
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:
|
|
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:
|
|
55 | 61 | ./${{ env.DISTPATH }}/espsecure -h || exit 1
|
56 | 62 | ./${{ env.DISTPATH }}/esp_rfc2217_server -h || exit 1
|
57 | 63 |
|
58 |
| - # Add license and readme |
59 |
| - mv LICENSE README.md ./${{ env.DISTPATH }} |
60 |
| -
|
61 | 64 | - name: Archive artifact
|
62 |
| - uses: actions/upload-artifact@master |
| 65 | + uses: actions/upload-artifact@v4 |
63 | 66 | with:
|
64 | 67 | name: ${{ env.DISTPATH }}
|
65 | 68 | path: ${{ env.DISTPATH }}
|
@@ -95,98 +98,104 @@ jobs:
|
95 | 98 | PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
|
96 | 99 | steps:
|
97 | 100 | - name: Checkout repository
|
98 |
| - uses: actions/checkout@master |
99 |
| - - name: Set up Python 3.8 |
100 |
| - uses: actions/setup-python@master |
| 101 | + uses: actions/checkout@v4 |
| 102 | + - name: Set up Python 3.11 |
| 103 | + uses: actions/setup-python@v5 |
101 | 104 | with:
|
102 |
| - python-version: 3.8 |
| 105 | + python-version: 3.11 |
| 106 | + - name: Update esptool version when releasing |
| 107 | + if: startsWith(github.ref, 'refs/tags/') |
| 108 | + run: | |
| 109 | + python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py |
| 110 | + #git diff |
103 | 111 | - name: Install dependencies
|
104 |
| - # PyInstaller >=6.0 results in significantly more antivirus false positives |
105 | 112 | run: |
|
106 | 113 | python -m pip install --upgrade pip
|
107 |
| - pip install pyinstaller==5.13.2 |
| 114 | + pip install pyinstaller==6.11.1 |
108 | 115 | pip install --user -e .
|
109 | 116 | - name: Build with PyInstaller
|
110 | 117 | run: |
|
111 | 118 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}1/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}1/" --add-data="${{ env.STUBS_DIR }}2/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}2/" esptool.py
|
112 | 119 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml${{ matrix.SEPARATOR }}${{ env.EFUSE_DIR }}" espefuse.py
|
113 | 120 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py
|
114 | 121 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico esp_rfc2217_server.py
|
115 |
| - - name: Sign binaries |
116 |
| - if: matrix.platform == 'windows' && github.event_name != 'pull_request' |
117 |
| - env: |
118 |
| - CERTIFICATE: ${{ secrets.CERTIFICATE }} |
119 |
| - CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} |
120 |
| - shell: pwsh |
121 |
| - run: | |
122 |
| - ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esptool.exe |
123 |
| - ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espefuse.exe |
124 |
| - ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espsecure.exe |
125 |
| - ./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esp_rfc2217_server.exe |
126 | 122 | - name: Test binaries
|
127 | 123 | shell: bash
|
128 | 124 | run: |
|
129 | 125 | ./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h
|
130 | 126 | ./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
|
131 | 127 | ./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
|
132 | 128 | ./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h
|
133 |
| - - name: Add license and readme |
134 |
| - shell: bash |
135 |
| - run: mv LICENSE README.md ./${{ env.DISTPATH }} |
136 | 129 | - name: Archive artifact
|
137 |
| - uses: actions/upload-artifact@master |
| 130 | + uses: actions/upload-artifact@v4 |
138 | 131 | with:
|
139 | 132 | name: ${{ env.DISTPATH }}
|
140 | 133 | path: ${{ env.DISTPATH }}
|
| 134 | + - name: Update package.json when a release tag is set |
| 135 | + if: startsWith(github.ref, 'refs/tags/') && matrix.platform == 'linux-amd64' |
| 136 | + run: | |
| 137 | + rm -f package.json |
| 138 | + python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }} |
| 139 | + - name: Upload package.json artifact |
| 140 | + if: startsWith(github.ref, 'refs/tags/') && matrix.platform == 'linux-amd64' |
| 141 | + uses: actions/upload-artifact@v4 |
| 142 | + with: |
| 143 | + name: manifest |
| 144 | + path: /home/runner/work/esptool/esptool/package.json |
141 | 145 |
|
142 |
| - create_release: |
143 |
| - name: Create GitHub release |
144 |
| - if: startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev')) |
145 |
| - needs: [build-esptool-binaries, build-esptool-binaries-arm] |
| 146 | + push_stubs: |
| 147 | + name: Commit changed package.json |
| 148 | + needs: build-esptool-binaries |
146 | 149 | runs-on: ubuntu-latest
|
147 |
| - env: |
148 |
| - PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi" |
149 |
| - permissions: |
150 |
| - contents: write |
151 | 150 | steps:
|
152 |
| - - name: Get version |
153 |
| - id: get_version |
154 |
| - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
155 |
| - shell: bash |
156 |
| - - name: Checkout |
157 |
| - uses: actions/checkout@master |
| 151 | + - name: Checkout repository |
| 152 | + uses: actions/checkout@v4 |
158 | 153 | with:
|
159 |
| - fetch-depth: 0 |
160 |
| - - name: Install dependencies |
161 |
| - run: | |
162 |
| - python -m pip install --upgrade pip |
163 |
| - pip install --user -e ".[dev]" |
164 |
| - - name: Generate changelog |
165 |
| - run: | |
166 |
| - cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md |
167 |
| - cat changelog_body.md |
168 |
| - - name: Download built binaries |
169 |
| - uses: actions/download-artifact@master |
170 |
| - - name: Compress and rename binaries |
171 |
| - run: | |
172 |
| - for dir in esptool-*; do |
173 |
| - if [[ "$dir" == esptool-win* ]]; then |
174 |
| - zip -r "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.zip" "$dir" |
175 |
| - else |
176 |
| - chmod -R u=rwx,g=rx,o=rx "$dir" |
177 |
| - tar -cvzf "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.tar.gz" "$dir" |
178 |
| - fi |
179 |
| - done |
180 |
| - - name: Create release |
181 |
| - id: create_release |
182 |
| - uses: softprops/action-gh-release@v1 |
183 |
| - env: |
184 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 154 | + ref: pioarduino |
| 155 | + if: startsWith(github.ref, 'refs/tags/') |
| 156 | + - name: Download artifacts |
| 157 | + uses: actions/download-artifact@v4 |
| 158 | + if: startsWith(github.ref, 'refs/tags/') |
185 | 159 | with:
|
186 |
| - body_path: changelog_body.md |
187 |
| - name: Version ${{ steps.get_version.outputs.VERSION }} |
188 |
| - draft: true |
189 |
| - prerelease: false |
190 |
| - files: | |
191 |
| - esptool-v${{ steps.get_version.outputs.VERSION }}-*.zip |
192 |
| - esptool-v${{ steps.get_version.outputs.VERSION }}-*.tar.gz |
| 160 | + name: | |
| 161 | + manifest |
| 162 | + path: | |
| 163 | + ./ |
| 164 | + - uses: stefanzweifel/git-auto-commit-action@v5 |
| 165 | + if: startsWith(github.ref, 'refs/tags/') |
| 166 | + with: |
| 167 | + commit_message: update manifest |
| 168 | + |
| 169 | + release: |
| 170 | + name: Upload release binaries |
| 171 | + needs: [build-esptool-binaries, build-esptool-binaries-arm, push_stubs] |
| 172 | + if: startsWith(github.ref, 'refs/tags/') |
| 173 | + runs-on: ubuntu-latest |
| 174 | + steps: |
| 175 | + - name: Checkout repository |
| 176 | + uses: actions/checkout@v4 |
| 177 | + - name: Zip esptool.py |
| 178 | + run: | |
| 179 | + echo "Packaging new esptool release: ${{ github.ref_name }}" |
| 180 | + python ci/patch_release.py --version ${{ github.ref_name }} esptool/__init__.py |
| 181 | + rm package.json |
| 182 | + python ci/gen_pio_manifest.py -o "./" -s ${{ github.ref_name }} |
| 183 | + python ci/pack_python.py |
| 184 | + - name: Download built binaries |
| 185 | + uses: actions/download-artifact@v4 |
| 186 | + - name: Rename and package binaries |
| 187 | + run: | |
| 188 | + zip -r esptool-armv7.zip ./esptool-armv7 |
| 189 | + zip -r esptool-aarch64.zip ./esptool-aarch64 |
| 190 | + zip -r esptool-macos-arm64.zip ./esptool-macos-arm64 |
| 191 | + zip -r esptool-macos-amd64.zip ./esptool-macos-amd64 |
| 192 | + zip -r esptool-linux-amd64.zip ./esptool-linux-amd64 |
| 193 | + zip -r esptool-win64.zip ./esptool-win64 |
| 194 | + - name: Release |
| 195 | + uses: jason2866/action-gh-release@v1.3 |
| 196 | + with: |
| 197 | + prerelease: false |
| 198 | + files: | |
| 199 | + *.zip |
| 200 | + env: |
| 201 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments