Skip to content

Commit 0b4dee5

Browse files
authored
dev: GitHub actions assets v2 (#5385)
1 parent 48ab0d1 commit 0b4dee5

File tree

5 files changed

+399
-1
lines changed

5 files changed

+399
-1
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
go.sum linguist-generated
2+
assets/* linguist-generated
23
* text=auto eol=lf
34
*.ps1 text eol=crlf

assets/github-action-config-v2.json

+191
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/gen_github_action_config/main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525

2626
func run(ctx context.Context) error {
2727
if len(os.Args) != 2 {
28-
return fmt.Errorf("usage: go run .../main.go out-path.json")
28+
return fmt.Errorf("usage: %s out-path.json", filepath.Base(os.Args[0]))
2929
}
3030

3131
allReleases, err := fetchAllReleases(ctx)
@@ -54,6 +54,13 @@ func run(ctx context.Context) error {
5454
return fmt.Errorf("failed to generate v1: %w", err)
5555
}
5656

57+
destV2 := filepath.Join(filepath.Dir(dest), strings.TrimSuffix(filepath.Base(dest), ext)+"-v2"+ext)
58+
59+
err = generate(allReleases, version{major: 2, minor: 0, patch: 0}, destV2)
60+
if err != nil {
61+
return fmt.Errorf("failed to generate v2: %w", err)
62+
}
63+
5764
return nil
5865
}
5966

scripts/gen_github_action_config/main_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ func Test_buildConfig(t *testing.T) {
2929
minVersion: version{major: 1, minor: 28, patch: 3},
3030
expected: "github-action-config-v1.json",
3131
},
32+
{
33+
desc: "v2",
34+
inputPath: "all-releases-v2.json",
35+
minVersion: version{major: 2, minor: 0, patch: 0},
36+
expected: "github-action-config-v2.json",
37+
},
3238
}
3339

3440
for _, test := range testCases {

0 commit comments

Comments
 (0)