Skip to content

Commit 41a9133

Browse files
authored
feat: Allow providing zipfile by name (#2)
* feat: Allow providing zipfile by name * readme: update
1 parent c0137d1 commit 41a9133

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ use.
4545
steps:
4646
- uses: esp-cpp/esp-packaged-programmer-action@v1.0.1
4747
with:
48-
zipfile-id: ${{ needs.build.outputs.zipfile-id }}
48+
zipfile-name: 'your-build-artifacts'
4949
programmer-name: 'your_programmer_name'
5050
```
5151
52+
> NOTE: you can use either `zipfile-name` or `zipfile-id` as input to this
53+
> script. If you are using MATRIX strategy (for which you may struggle to get
54+
> the zipfile id output for each step), you may want to use the `zipfile-name`
55+
> instead.
56+
5257
See the example in [Using this action](#using-this-action) for a more complete
5358
example showing how to build your code and zip it for use by this action.
5459

@@ -79,6 +84,10 @@ Below is an example workflow file that:
7984
binaries into executable flashing programs for `windows`, `macos`, and
8085
`linux`.
8186

87+
In the example below, we are using the `zipfile-id` input and hard-linking that
88+
to the `build` job output. You could instead use the `zipfile-name` input and
89+
provide it the name of the artifact (`firmware`) in this case.
90+
8291
```yaml
8392
on:
8493
push:

action.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ name: 'ESP Packaged Programmer'
22
description: 'Package esptool and the binaries into an executable'
33
inputs:
44
zipfile-id:
5-
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.'
6-
required: true
5+
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.'
6+
required: false
7+
default: ''
8+
zipfile-name:
9+
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.'
10+
required: false
11+
default: ''
712
programmer-name:
813
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.'
914
required: false
@@ -15,6 +20,20 @@ outputs:
1520
runs:
1621
using: "composite"
1722
steps:
23+
- name: Ensure that one of zipfile-id or zipfile-name is set
24+
if: ${{ inputs.zipfile-id == '' && inputs.zipfile-name == '' }}
25+
shell: bash
26+
run: |
27+
echo "::error title=⛔ error hint::Either zipfile-id or zipfile-name must be set"
28+
exit 1
29+
30+
- name: Ensure that only zipfile-id or zipfile-name is set, not both
31+
if: ${{ inputs.zipfile-id != '' && inputs.zipfile-name != '' }}
32+
shell: bash
33+
run: |
34+
echo "::error title=⛔ error hint::Only one of zipfile-id or zipfile-name can be set"
35+
exit 1
36+
1837
- name: Check Runner OS
1938
if: ${{ runner.os != 'Linux' && runner.os != 'Windows' && runner.os != 'macOS'}}
2039
shell: bash
@@ -53,6 +72,7 @@ runs:
5372
uses: actions/download-artifact@v4
5473
id: download_zipfile
5574
with:
75+
name: ${{ inputs.zipfile-name }}
5676
artifact-ids: ${{ inputs.zipfile-id }}
5777
path: ${{ github.action_path }}/build
5878

0 commit comments

Comments
 (0)