Skip to content

dev: GitHub actions assets v2 #5385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 17, 2025
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
go.sum linguist-generated
assets/* linguist-generated
* text=auto eol=lf
*.ps1 text eol=crlf
191 changes: 191 additions & 0 deletions assets/github-action-config-v2.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion scripts/gen_github_action_config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {

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

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

destV2 := filepath.Join(filepath.Dir(dest), strings.TrimSuffix(filepath.Base(dest), ext)+"-v2"+ext)

err = generate(allReleases, version{major: 2, minor: 0, patch: 0}, destV2)
if err != nil {
return fmt.Errorf("failed to generate v2: %w", err)
}

return nil
}

Expand Down
6 changes: 6 additions & 0 deletions scripts/gen_github_action_config/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func Test_buildConfig(t *testing.T) {
minVersion: version{major: 1, minor: 28, patch: 3},
expected: "github-action-config-v1.json",
},
{
desc: "v2",
inputPath: "all-releases-v2.json",
minVersion: version{major: 2, minor: 0, patch: 0},
expected: "github-action-config-v2.json",
},
}

for _, test := range testCases {
Expand Down
Loading
Loading