Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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:
Expand Down
24 changes: 22 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -53,6 +72,7 @@ runs:
uses: actions/download-artifact@v4
id: download_zipfile
with:
name: ${{ inputs.zipfile-name }}
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the download-artifact step, both 'zipfile-name' and 'zipfile-id' are always passed to the action. Consider conditionally providing only the set input, so that the action receives a single valid value and avoids potential unexpected behavior when one of the inputs is empty.

Copilot uses AI. Check for mistakes.
artifact-ids: ${{ inputs.zipfile-id }}
path: ${{ github.action_path }}/build

Expand Down