|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: build-windows |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # this is a called workflow |
| 8 | + workflow_call: |
| 9 | + outputs: |
| 10 | + build-file: |
| 11 | + description: "The output of this build procsss" |
| 12 | + value: ${{ jobs.windows-build-job.outputs.install-file }} |
| 13 | + |
| 14 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 15 | +jobs: |
| 16 | + # Build the installer on mac |
| 17 | + windows-build-job: |
| 18 | + # The type of runner that the job will run on |
| 19 | + runs-on: windows-latest |
| 20 | + |
| 21 | + # Output |
| 22 | + outputs: |
| 23 | + install-file: ${{ steps.output-installer.outputs.filename }} |
| 24 | + |
| 25 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 26 | + steps: |
| 27 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: '3.12' |
| 32 | + |
| 33 | + # Setup python |
| 34 | + - name: System Setup |
| 35 | + run: | |
| 36 | + pip install pyinstaller pyqt5 darkdetect argparse intelhex esptool mpremote requests psutil |
| 37 | +
|
| 38 | + # Build the installer. |
| 39 | + - name: Build Windows Installer |
| 40 | + shell: powershell |
| 41 | + run: | |
| 42 | + ren MicroPython_Firmware_Uploader\resource\teensy_loader_cli_windows.exe teensy_loader_cli.exe |
| 43 | + $ESPTOOL_TARGETS = echo "$(pip show esptool | findstr "Location: ")" |
| 44 | + $ESPTOOL_TARGETS = $ESPTOOL_TARGETS.Substring(10) |
| 45 | + $ESPTOOL_TARGETS_1 = echo "${ESPTOOL_TARGETS}\esptool\targets\stub_flasher\1\*.json;.\esptool\targets\stub_flasher\1\" |
| 46 | + $ESPTOOL_TARGETS_2 = echo "${ESPTOOL_TARGETS}\esptool\targets\stub_flasher\2\*.json;.\esptool\targets\stub_flasher\2\" |
| 47 | + pyinstaller --onefile --clean --name MicroPythonUploader --noconsole --distpath=. --icon=MicroPython_Firmware_Uploader\resource\sfe_flame.ico --add-data="MicroPython_Firmware_Uploader\resource\*;resource\" --add-data="${ESPTOOL_TARGETS_1}" --add-data="${ESPTOOL_TARGETS_2}" MicroPython_Firmware_Upload.py |
| 48 | + |
| 49 | + - name: Compress Installer |
| 50 | + shell: powershell |
| 51 | + run: | |
| 52 | + $compress = @{ |
| 53 | + Path = ".\MicroPythonUploader.exe" |
| 54 | + CompressionLevel = "Fastest" |
| 55 | + DestinationPath = ".\MicroPythonUploader.win.zip" |
| 56 | + } |
| 57 | + Compress-Archive @compress |
| 58 | + |
| 59 | + - uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: MicroPythonUploader.win.zip |
| 62 | + path: MicroPythonUploader.win.zip |
| 63 | + |
| 64 | + # Use Windows powershell notation: $env:GITHUB_OUTPUT |
| 65 | + - id: output-installer |
| 66 | + run: echo "filename=MicroPythonUploader.win.zip" >> $env:GITHUB_OUTPUT |
0 commit comments