Skip to content

Commit 436c180

Browse files
feat: add support for UF2 firmwares
1 parent cc0b28d commit 436c180

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

firmware/podman_builder.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ func (builder *PodmanBuilder) buildCmdArgs(
8888
return append(args, buildContainer, "./tools/build-gh.sh")
8989
}
9090

91+
func (builder *PodmanBuilder) matchBuildArtefacts(patterns ...string) ([]string, error) {
92+
var matches []string
93+
94+
for _, pattern := range patterns {
95+
found, err := filepath.Glob(filepath.Join(builder.workingDir, pattern))
96+
if err != nil {
97+
return nil, fmt.Errorf("error with pattern %s: %w", pattern, err)
98+
}
99+
matches = append(matches, found...)
100+
}
101+
return matches, nil
102+
}
103+
91104
func (builder *PodmanBuilder) Build(
92105
ctx context.Context,
93106
buildContainer string,
@@ -108,7 +121,7 @@ func (builder *PodmanBuilder) Build(
108121
return nil, fmt.Errorf("failed to build: %w", err)
109122
}
110123

111-
firmwarePaths, err := filepath.Glob(filepath.Join(builder.workingDir, "*.bin"))
124+
firmwarePaths, err := builder.matchBuildArtefacts("*.uf2", "*.bin")
112125
if err != nil || len(firmwarePaths) == 0 {
113126
return nil, fmt.Errorf("cannot find build artifact: %w", err)
114127
}

0 commit comments

Comments
 (0)