From f54ea2acdcdb3ef9a4b62e95c1fa1bb42372c57b Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Thu, 15 May 2025 08:24:38 -0500 Subject: [PATCH 1/2] feat: Allow providing zipfile by name --- action.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 025e245..0f9c09c 100644 --- a/action.yml +++ b/action.yml @@ -2,8 +2,13 @@ name: 'ESP Packaged Programmer' description: 'Package esptool and the binaries into an executable' inputs: zipfile-id: - description: 'Artifact ID for the Zipfile to download. Zipfile should contain firmware.bin, bootloader.bin, partition-table.bin, and flasher_args.json. May optionally contain filesystem binaries and associated -flash_args files.' - required: true + description: 'Artifact ID for the Zipfile to download. Zipfile should contain firmware.bin, bootloader.bin, partition-table.bin, and flasher_args.json. May optionally contain filesystem binaries and associated -flash_args files. NOTE: only one of zipfile-id or zipfile-name should be set.' + required: false + default: '' + zipfile-name: + description: 'Name of the zipfile artifact that was packaged and uploaded. Zipfile should contain firmware.bin, bootloader.bin, partition-table.bin, and flasher_args.json. May optionally contain filesystem binaries and associated -flash_args files. NOTE: only one of zipfile-id or zipfile-name should be set.' + required: false + default: '' programmer-name: description: 'Base name of the programmer executable. Will have version tag (e.g. v1.0.0 or commit hash if no tags) and OS suffix (e.g. windows, linux, macos) appended.' required: false @@ -15,6 +20,20 @@ outputs: runs: using: "composite" steps: + - name: Ensure that one of zipfile-id or zipfile-name is set + if: ${{ inputs.zipfile-id == '' && inputs.zipfile-name == '' }} + shell: bash + run: | + echo "::error title=⛔ error hint::Either zipfile-id or zipfile-name must be set" + exit 1 + + - name: Ensure that only zipfile-id or zipfile-name is set, not both + if: ${{ inputs.zipfile-id != '' && inputs.zipfile-name != '' }} + shell: bash + run: | + echo "::error title=⛔ error hint::Only one of zipfile-id or zipfile-name can be set" + exit 1 + - name: Check Runner OS if: ${{ runner.os != 'Linux' && runner.os != 'Windows' && runner.os != 'macOS'}} shell: bash @@ -53,6 +72,7 @@ runs: uses: actions/download-artifact@v4 id: download_zipfile with: + name: ${{ inputs.zipfile-name }} artifact-ids: ${{ inputs.zipfile-id }} path: ${{ github.action_path }}/build From a1c7f76d5d5de0a1c0448b80f1234a9147b64d2a Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Thu, 15 May 2025 08:29:42 -0500 Subject: [PATCH 2/2] readme: update --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 01107c5..3e606fd 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,15 @@ use. steps: - uses: esp-cpp/esp-packaged-programmer-action@v1.0.1 with: - zipfile-id: ${{ needs.build.outputs.zipfile-id }} + zipfile-name: 'your-build-artifacts' programmer-name: 'your_programmer_name' ``` +> NOTE: you can use either `zipfile-name` or `zipfile-id` as input to this +> script. If you are using MATRIX strategy (for which you may struggle to get +> the zipfile id output for each step), you may want to use the `zipfile-name` +> instead. + See the example in [Using this action](#using-this-action) for a more complete example showing how to build your code and zip it for use by this action. @@ -79,6 +84,10 @@ Below is an example workflow file that: binaries into executable flashing programs for `windows`, `macos`, and `linux`. +In the example below, we are using the `zipfile-id` input and hard-linking that +to the `build` job output. You could instead use the `zipfile-name` input and +provide it the name of the artifact (`firmware`) in this case. + ```yaml on: push: