From 3c2a002517b601f10eb3114644f4ceefb3814794 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Fri, 15 Nov 2024 15:18:07 -0800 Subject: [PATCH 01/15] feat: add main branch tagging from release --- .github/workflows/workflow-executor.yaml | 2 +- action.yml | 2 +- internal/actions/release.go | 57 ++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-executor.yaml b/.github/workflows/workflow-executor.yaml index a51c7ba8..c18137a7 100644 --- a/.github/workflows/workflow-executor.yaml +++ b/.github/workflows/workflow-executor.yaml @@ -191,7 +191,7 @@ jobs: - id: run-workflow name: Run Generation Workflow if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' }} - uses: speakeasy-api/sdk-generation-action@v15 + uses: speakeasy-api/sdk-generation-action@v15.32.8 with: speakeasy_version: ${{ inputs.speakeasy_version }} github_access_token: ${{ secrets.github_access_token }} diff --git a/action.yml b/action.yml index 4f1538d6..01352e69 100644 --- a/action.yml +++ b/action.yml @@ -169,7 +169,7 @@ outputs: description: "The directory the SDK target was generated to" runs: using: "docker" - image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15" + image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15.32.8" env: SPEAKEASY_API_KEY: ${{ inputs.speakeasy_api_key }} SPEAKEASY_SERVER_URL: ${{ inputs.speakeasy_server_url }} diff --git a/internal/actions/release.go b/internal/actions/release.go index f582e01c..326012c0 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -3,11 +3,14 @@ package actions import ( "errors" "fmt" + "os" "path/filepath" "strings" + "github.com/speakeasy-api/sdk-generation-action/internal/cli" "github.com/speakeasy-api/sdk-generation-action/internal/configuration" "github.com/speakeasy-api/sdk-generation-action/internal/environment" + "github.com/speakeasy-api/sdk-generation-action/internal/git" "github.com/speakeasy-api/sdk-generation-action/internal/logging" "github.com/speakeasy-api/sdk-generation-action/internal/run" "github.com/speakeasy-api/sdk-generation-action/pkg/releases" @@ -90,6 +93,12 @@ func Release() error { return err } + if os.Getenv("SPEAKEASY_API_KEY") != "" { + if err = addCurrentBranchTagging(g, latestRelease.Languages); err != nil { + logging.Debug("failed to tag registry images: %v", err) + } + } + return nil } @@ -146,3 +155,51 @@ func addPublishOutputs(dir string, outputs map[string]string) error { return nil } + +func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.LanguageReleaseInfo) error { + _, err := cli.Download("latest", g) + if err != nil { + return err + } + + var sources, targets []string + branch := strings.TrimPrefix(os.Getenv("GITHUB_REF"), "refs/heads/") + workflow, err := configuration.GetWorkflowAndValidateLanguages(true) + if err != nil { + return err + } + + if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { + if target, ok := workflow.Targets[specificTarget]; ok { + sources = append(sources, target.Source) + targets = append(targets, specificTarget) + } + } else { + for name, target := range workflow.Targets { + if releaseInfo, ok := latestRelease[target.Target]; ok { + releasePath, err := filepath.Rel(".", releaseInfo.Path) + if err != nil { + return err + } + + if releasePath == "" && target.Output == nil { + sources = append(sources, target.Source) + targets = append(targets, name) + } + + if target.Output != nil { + if outputPath, err := filepath.Rel(".", *target.Output); err != nil && outputPath == releasePath { + sources = append(sources, target.Source) + targets = append(targets, name) + } + } + } + } + } + + if len(sources) > 0 && len(targets) > 0 && branch != "" { + return cli.Tag([]string{branch}, sources, targets) + } + + return nil +} From bb298a52ccf59b717b07cc6fd12a2316bf270383 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 09:39:08 -0800 Subject: [PATCH 02/15] feat: update --- internal/actions/release.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/actions/release.go b/internal/actions/release.go index 326012c0..7e876758 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -93,7 +93,9 @@ func Release() error { return err } + fmt.Println("WE HAVE API KEY") if os.Getenv("SPEAKEASY_API_KEY") != "" { + fmt.Println("WE HAVE DON'T API KEY") if err = addCurrentBranchTagging(g, latestRelease.Languages); err != nil { logging.Debug("failed to tag registry images: %v", err) } @@ -197,6 +199,10 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } } + fmt.Println("BRANCH: ", branch) + fmt.Println("SOURCES: ", sources) + fmt.Println("TARGETS: ", targets) + if len(sources) > 0 && len(targets) > 0 && branch != "" { return cli.Tag([]string{branch}, sources, targets) } From 2925b7642afb60bd67adeb91b914fe91b39c7a8e Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 10:07:37 -0800 Subject: [PATCH 03/15] feat: update --- .github/workflows/sdk-publish.yaml | 2 +- internal/actions/release.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sdk-publish.yaml b/.github/workflows/sdk-publish.yaml index d9dbfad5..c010beca 100644 --- a/.github/workflows/sdk-publish.yaml +++ b/.github/workflows/sdk-publish.yaml @@ -101,7 +101,7 @@ jobs: - name: Tune GitHub-hosted runner network uses: smorimoto/tune-github-hosted-runner-network@v1 - id: release - uses: speakeasy-api/sdk-generation-action@v15 + uses: speakeasy-api/sdk-generation-action@v15.32.8 with: github_access_token: ${{ secrets.github_access_token }} action: "release" diff --git a/internal/actions/release.go b/internal/actions/release.go index 7e876758..4a149c81 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -93,9 +93,9 @@ func Release() error { return err } - fmt.Println("WE HAVE API KEY") + fmt.Println("WE ENTERED") if os.Getenv("SPEAKEASY_API_KEY") != "" { - fmt.Println("WE HAVE DON'T API KEY") + fmt.Println("WE HAVE API KEY") if err = addCurrentBranchTagging(g, latestRelease.Languages); err != nil { logging.Debug("failed to tag registry images: %v", err) } @@ -172,6 +172,7 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { + fmt.Println("WE HAVE SPECIFIC TARGET") if target, ok := workflow.Targets[specificTarget]; ok { sources = append(sources, target.Source) targets = append(targets, specificTarget) @@ -184,6 +185,10 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu return err } + fmt.Println("WE HAVE RELEASE INFO") + fmt.Println(target.Output) + fmt.Println(releasePath) + if releasePath == "" && target.Output == nil { sources = append(sources, target.Source) targets = append(targets, name) From 794d06f7f2b4aaa312a1b58fdb8c2ae6e184e6a0 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 10:14:33 -0800 Subject: [PATCH 04/15] feat: update --- .github/workflows/sdk-publish.yaml | 2 +- .github/workflows/workflow-executor.yaml | 2 +- action.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sdk-publish.yaml b/.github/workflows/sdk-publish.yaml index c010beca..d47af2eb 100644 --- a/.github/workflows/sdk-publish.yaml +++ b/.github/workflows/sdk-publish.yaml @@ -101,7 +101,7 @@ jobs: - name: Tune GitHub-hosted runner network uses: smorimoto/tune-github-hosted-runner-network@v1 - id: release - uses: speakeasy-api/sdk-generation-action@v15.32.8 + uses: speakeasy-api/sdk-generation-action@v15.32.9 with: github_access_token: ${{ secrets.github_access_token }} action: "release" diff --git a/.github/workflows/workflow-executor.yaml b/.github/workflows/workflow-executor.yaml index c18137a7..a51c7ba8 100644 --- a/.github/workflows/workflow-executor.yaml +++ b/.github/workflows/workflow-executor.yaml @@ -191,7 +191,7 @@ jobs: - id: run-workflow name: Run Generation Workflow if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' }} - uses: speakeasy-api/sdk-generation-action@v15.32.8 + uses: speakeasy-api/sdk-generation-action@v15 with: speakeasy_version: ${{ inputs.speakeasy_version }} github_access_token: ${{ secrets.github_access_token }} diff --git a/action.yml b/action.yml index 01352e69..458de6fb 100644 --- a/action.yml +++ b/action.yml @@ -169,7 +169,7 @@ outputs: description: "The directory the SDK target was generated to" runs: using: "docker" - image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15.32.8" + image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15.32.9" env: SPEAKEASY_API_KEY: ${{ inputs.speakeasy_api_key }} SPEAKEASY_SERVER_URL: ${{ inputs.speakeasy_server_url }} From 92f9f3e73aa4a0622adee90b913c88f417ca1b36 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 11:58:35 -0800 Subject: [PATCH 05/15] feat: update --- internal/actions/release.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/actions/release.go b/internal/actions/release.go index 4a149c81..d9c88c76 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -185,16 +185,15 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu return err } - fmt.Println("WE HAVE RELEASE INFO") - fmt.Println(target.Output) - fmt.Println(releasePath) - - if releasePath == "" && target.Output == nil { + if (releasePath == "" || releasePath == ".") && target.Output == nil { sources = append(sources, target.Source) targets = append(targets, name) } if target.Output != nil { + fmt.Println("WE HAVE RELEASE INFO") + fmt.Println(filepath.Rel(".", *target.Output)) + fmt.Println(releasePath) if outputPath, err := filepath.Rel(".", *target.Output); err != nil && outputPath == releasePath { sources = append(sources, target.Source) targets = append(targets, name) From 9b631e49a24df2d35748691f6b5b740278dfb363 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 12:35:27 -0800 Subject: [PATCH 06/15] feat: update --- internal/actions/release.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/actions/release.go b/internal/actions/release.go index d9c88c76..e130422d 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -191,10 +191,15 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } if target.Output != nil { + outputPath, err := filepath.Rel(".", *target.Output) + if err != nil { + return err + } + outputPath = filepath.Join(environment.GetWorkingDirectory(), outputPath) fmt.Println("WE HAVE RELEASE INFO") - fmt.Println(filepath.Rel(".", *target.Output)) + fmt.Println(outputPath) fmt.Println(releasePath) - if outputPath, err := filepath.Rel(".", *target.Output); err != nil && outputPath == releasePath { + if outputPath == releasePath { sources = append(sources, target.Source) targets = append(targets, name) } From 91f0374c516a745f9e88e62a878fe4bda1ae4725 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 13:10:17 -0800 Subject: [PATCH 07/15] feat: update --- .github/workflows/sdk-publish.yaml | 2 +- action.yml | 2 +- internal/actions/release.go | 11 +---------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/sdk-publish.yaml b/.github/workflows/sdk-publish.yaml index d47af2eb..d9dbfad5 100644 --- a/.github/workflows/sdk-publish.yaml +++ b/.github/workflows/sdk-publish.yaml @@ -101,7 +101,7 @@ jobs: - name: Tune GitHub-hosted runner network uses: smorimoto/tune-github-hosted-runner-network@v1 - id: release - uses: speakeasy-api/sdk-generation-action@v15.32.9 + uses: speakeasy-api/sdk-generation-action@v15 with: github_access_token: ${{ secrets.github_access_token }} action: "release" diff --git a/action.yml b/action.yml index 458de6fb..4f1538d6 100644 --- a/action.yml +++ b/action.yml @@ -169,7 +169,7 @@ outputs: description: "The directory the SDK target was generated to" runs: using: "docker" - image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15.32.9" + image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15" env: SPEAKEASY_API_KEY: ${{ inputs.speakeasy_api_key }} SPEAKEASY_SERVER_URL: ${{ inputs.speakeasy_server_url }} diff --git a/internal/actions/release.go b/internal/actions/release.go index e130422d..fced4d2a 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -93,9 +93,7 @@ func Release() error { return err } - fmt.Println("WE ENTERED") if os.Getenv("SPEAKEASY_API_KEY") != "" { - fmt.Println("WE HAVE API KEY") if err = addCurrentBranchTagging(g, latestRelease.Languages); err != nil { logging.Debug("failed to tag registry images: %v", err) } @@ -172,7 +170,6 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { - fmt.Println("WE HAVE SPECIFIC TARGET") if target, ok := workflow.Targets[specificTarget]; ok { sources = append(sources, target.Source) targets = append(targets, specificTarget) @@ -185,6 +182,7 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu return err } + // check for no SDK output path if (releasePath == "" || releasePath == ".") && target.Output == nil { sources = append(sources, target.Source) targets = append(targets, name) @@ -196,9 +194,6 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu return err } outputPath = filepath.Join(environment.GetWorkingDirectory(), outputPath) - fmt.Println("WE HAVE RELEASE INFO") - fmt.Println(outputPath) - fmt.Println(releasePath) if outputPath == releasePath { sources = append(sources, target.Source) targets = append(targets, name) @@ -208,10 +203,6 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } } - fmt.Println("BRANCH: ", branch) - fmt.Println("SOURCES: ", sources) - fmt.Println("TARGETS: ", targets) - if len(sources) > 0 && len(targets) > 0 && branch != "" { return cli.Tag([]string{branch}, sources, targets) } From d3cd3ed4d667b6d0ef8e5f74068a802f63f3b4ac Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 14:58:48 -0800 Subject: [PATCH 08/15] feat: update with newest sdk gen config --- go.mod | 3 ++- go.sum | 4 ++-- internal/actions/release.go | 27 +++++++++++++++++++++------ internal/actions/runWorkflow.go | 23 +++++++++++++++++------ 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 2e8b8076..fcdd3be6 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,9 @@ require ( github.com/hashicorp/go-version v1.6.0 github.com/joho/godotenv v1.5.1 github.com/pb33f/libopenapi v0.15.14 + github.com/pkg/errors v0.9.1 github.com/speakeasy-api/git-diff-parser v0.0.3 - github.com/speakeasy-api/sdk-gen-config v1.7.4 + github.com/speakeasy-api/sdk-gen-config v1.28.0 github.com/speakeasy-api/speakeasy-client-sdk-go/v3 v3.15.4 github.com/speakeasy-api/versioning-reports v0.6.0 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 0c20b2ad..b995eebb 100644 --- a/go.sum +++ b/go.sum @@ -138,8 +138,8 @@ github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2 github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/speakeasy-api/git-diff-parser v0.0.3 h1:LL12d+HMtSyj6O/hQqIn/lgDPYI6ci/DEhk0la/xA+0= github.com/speakeasy-api/git-diff-parser v0.0.3/go.mod h1:P46HmmVVmwA9P8h2wa0fDpmRM8/grbVQ+uKhWDtpkIY= -github.com/speakeasy-api/sdk-gen-config v1.7.4 h1:hk3GaKiL6zxx3SulnxdunvU2V7bUSQ4YviXtIiUmWuo= -github.com/speakeasy-api/sdk-gen-config v1.7.4/go.mod h1:4R+8FTyM6UdLHltOVAigIoR5D2UfPsGMmEFzPOP1yCs= +github.com/speakeasy-api/sdk-gen-config v1.28.0 h1:Gm3WqJCxs7ExEJcRVhMsUq2mC7S23m18zpvtFaPEuys= +github.com/speakeasy-api/sdk-gen-config v1.28.0/go.mod h1:e9PjnCRHGa4K4EFKVU+kKmihOZjJ2V4utcU+274+bnQ= github.com/speakeasy-api/speakeasy-client-sdk-go/v3 v3.15.4 h1:lPVNakwHrrRWRaNIdIHE6BK7RI6B/jpdwbtvI/xPEYo= github.com/speakeasy-api/speakeasy-client-sdk-go/v3 v3.15.4/go.mod h1:b4fiZ1Wid0JHwwiYqhaPifDwjmC15uiN7A8Cmid+9kw= github.com/speakeasy-api/versioning-reports v0.6.0 h1:oLokEQ7xnDXqWAQk60Sk+ifwYaRbq3BrLX2KyT8gWxE= diff --git a/internal/actions/release.go b/internal/actions/release.go index fced4d2a..d4d5868e 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -1,12 +1,12 @@ package actions import ( - "errors" "fmt" "os" "path/filepath" "strings" + "github.com/pkg/errors" "github.com/speakeasy-api/sdk-generation-action/internal/cli" "github.com/speakeasy-api/sdk-generation-action/internal/configuration" "github.com/speakeasy-api/sdk-generation-action/internal/environment" @@ -95,7 +95,7 @@ func Release() error { if os.Getenv("SPEAKEASY_API_KEY") != "" { if err = addCurrentBranchTagging(g, latestRelease.Languages); err != nil { - logging.Debug("failed to tag registry images: %v", err) + return errors.Wrap(err, "failed to tag registry images") } } @@ -169,14 +169,21 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu return err } + // the tagging library treats targets synonymously with code samples if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { if target, ok := workflow.Targets[specificTarget]; ok { - sources = append(sources, target.Source) - targets = append(targets, specificTarget) + if source, ok := workflow.Sources[target.Source]; ok && source.Registry != nil { + sources = append(sources, target.Source) + } + + if target.CodeSamples != nil && target.CodeSamples.Registry != nil { + targets = append(targets, specificTarget) + } } } else { for name, target := range workflow.Targets { if releaseInfo, ok := latestRelease[target.Target]; ok { + var targetIsMatched bool releasePath, err := filepath.Rel(".", releaseInfo.Path) if err != nil { return err @@ -184,8 +191,7 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu // check for no SDK output path if (releasePath == "" || releasePath == ".") && target.Output == nil { - sources = append(sources, target.Source) - targets = append(targets, name) + targetIsMatched = true } if target.Output != nil { @@ -195,7 +201,16 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } outputPath = filepath.Join(environment.GetWorkingDirectory(), outputPath) if outputPath == releasePath { + targetIsMatched = true + } + } + + if targetIsMatched { + if source, ok := workflow.Sources[target.Source]; ok && source.Registry != nil { sources = append(sources, target.Source) + } + + if target.CodeSamples != nil && target.CodeSamples.Registry != nil { targets = append(targets, name) } } diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index 72fef9d7..d6ae506f 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/google/go-github/v63/github" + "github.com/pkg/errors" "github.com/speakeasy-api/sdk-generation-action/internal/versionbumps" "github.com/speakeasy-api/versioning-reports/versioning" @@ -284,7 +285,7 @@ func finalize(inputs finalizeInputs) error { // add merging branch registry tag if err = addDirectModeBranchTagging(); err != nil { - logging.Debug("failed to tag registry images: %v", err) + return errors.Wrap(err, "failed to tag registry images") } inputs.Outputs["commit_hash"] = commitHash @@ -303,14 +304,24 @@ func addDirectModeBranchTagging() error { var sources, targets []string if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { - if target, ok := wf.Targets[environment.SpecifiedTarget()]; ok { - sources = append(sources, target.Source) - targets = append(targets, specificTarget) + if target, ok := wf.Targets[specificTarget]; ok { + if source, ok := wf.Sources[target.Source]; ok && source.Registry != nil { + sources = append(sources, target.Source) + } + + if target.CodeSamples != nil && target.CodeSamples.Registry != nil { + targets = append(targets, specificTarget) + } } } else { for name, target := range wf.Targets { - sources = append(sources, target.Source) - targets = append(targets, name) + if source, ok := wf.Sources[target.Source]; ok && source.Registry != nil { + sources = append(sources, target.Source) + } + + if target.CodeSamples != nil && target.CodeSamples.Registry != nil { + targets = append(targets, name) + } } } if len(sources) > 0 && len(targets) > 0 && branch != "" { From c2a99aa24f4bca57c706b191d4c3d7fe63d27d4e Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 15:02:09 -0800 Subject: [PATCH 09/15] feat: update --- .github/workflows/sdk-publish.yaml | 2 +- .github/workflows/workflow-executor.yaml | 2 +- action.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sdk-publish.yaml b/.github/workflows/sdk-publish.yaml index d9dbfad5..d47af2eb 100644 --- a/.github/workflows/sdk-publish.yaml +++ b/.github/workflows/sdk-publish.yaml @@ -101,7 +101,7 @@ jobs: - name: Tune GitHub-hosted runner network uses: smorimoto/tune-github-hosted-runner-network@v1 - id: release - uses: speakeasy-api/sdk-generation-action@v15 + uses: speakeasy-api/sdk-generation-action@v15.32.9 with: github_access_token: ${{ secrets.github_access_token }} action: "release" diff --git a/.github/workflows/workflow-executor.yaml b/.github/workflows/workflow-executor.yaml index a51c7ba8..1a5821c7 100644 --- a/.github/workflows/workflow-executor.yaml +++ b/.github/workflows/workflow-executor.yaml @@ -191,7 +191,7 @@ jobs: - id: run-workflow name: Run Generation Workflow if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' }} - uses: speakeasy-api/sdk-generation-action@v15 + uses: speakeasy-api/sdk-generation-action@v15.32.9 with: speakeasy_version: ${{ inputs.speakeasy_version }} github_access_token: ${{ secrets.github_access_token }} diff --git a/action.yml b/action.yml index 4f1538d6..458de6fb 100644 --- a/action.yml +++ b/action.yml @@ -169,7 +169,7 @@ outputs: description: "The directory the SDK target was generated to" runs: using: "docker" - image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15" + image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15.32.9" env: SPEAKEASY_API_KEY: ${{ inputs.speakeasy_api_key }} SPEAKEASY_SERVER_URL: ${{ inputs.speakeasy_server_url }} From 7508f396aec41a224c403cb4928df1d507ec4714 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 15:03:39 -0800 Subject: [PATCH 10/15] feat: update --- internal/actions/runWorkflow.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index d6ae506f..bba168a8 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -303,6 +303,7 @@ func addDirectModeBranchTagging() error { branch := strings.TrimPrefix(os.Getenv("GITHUB_REF"), "refs/heads/") var sources, targets []string + // the tagging library treats targets synonymously with code samples if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { if target, ok := wf.Targets[specificTarget]; ok { if source, ok := wf.Sources[target.Source]; ok && source.Registry != nil { From e41ecd9cbc76fee1a9fa1b44c981391d58a74691 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 16:23:34 -0800 Subject: [PATCH 11/15] feat: update --- internal/actions/runWorkflow.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index bba168a8..daee1eb2 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -307,11 +307,11 @@ func addDirectModeBranchTagging() error { if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { if target, ok := wf.Targets[specificTarget]; ok { if source, ok := wf.Sources[target.Source]; ok && source.Registry != nil { - sources = append(sources, target.Source) + sources = append(sources, "test") } if target.CodeSamples != nil && target.CodeSamples.Registry != nil { - targets = append(targets, specificTarget) + targets = append(targets, "test") } } } else { From c5682b5406d78628411de63c9113ec6d24729a26 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 16:28:32 -0800 Subject: [PATCH 12/15] feat: update --- internal/actions/release.go | 2 +- internal/actions/runWorkflow.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/actions/release.go b/internal/actions/release.go index d4d5868e..ced654d7 100644 --- a/internal/actions/release.go +++ b/internal/actions/release.go @@ -218,7 +218,7 @@ func addCurrentBranchTagging(g *git.Git, latestRelease map[string]releases.Langu } } - if len(sources) > 0 && len(targets) > 0 && branch != "" { + if (len(sources) > 0 || len(targets) > 0) && branch != "" { return cli.Tag([]string{branch}, sources, targets) } diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index daee1eb2..f5aaa20b 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -325,7 +325,7 @@ func addDirectModeBranchTagging() error { } } } - if len(sources) > 0 && len(targets) > 0 && branch != "" { + if (len(sources) > 0 || len(targets) > 0) && branch != "" { return cli.Tag([]string{branch}, sources, targets) } From debfa17559f6cf645a4c844623e981e8207c5b24 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 16:31:20 -0800 Subject: [PATCH 13/15] feat: update --- .github/workflows/sdk-publish.yaml | 2 +- .github/workflows/workflow-executor.yaml | 2 +- action.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sdk-publish.yaml b/.github/workflows/sdk-publish.yaml index d47af2eb..d9dbfad5 100644 --- a/.github/workflows/sdk-publish.yaml +++ b/.github/workflows/sdk-publish.yaml @@ -101,7 +101,7 @@ jobs: - name: Tune GitHub-hosted runner network uses: smorimoto/tune-github-hosted-runner-network@v1 - id: release - uses: speakeasy-api/sdk-generation-action@v15.32.9 + uses: speakeasy-api/sdk-generation-action@v15 with: github_access_token: ${{ secrets.github_access_token }} action: "release" diff --git a/.github/workflows/workflow-executor.yaml b/.github/workflows/workflow-executor.yaml index 1a5821c7..a51c7ba8 100644 --- a/.github/workflows/workflow-executor.yaml +++ b/.github/workflows/workflow-executor.yaml @@ -191,7 +191,7 @@ jobs: - id: run-workflow name: Run Generation Workflow if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' }} - uses: speakeasy-api/sdk-generation-action@v15.32.9 + uses: speakeasy-api/sdk-generation-action@v15 with: speakeasy_version: ${{ inputs.speakeasy_version }} github_access_token: ${{ secrets.github_access_token }} diff --git a/action.yml b/action.yml index 458de6fb..4f1538d6 100644 --- a/action.yml +++ b/action.yml @@ -169,7 +169,7 @@ outputs: description: "The directory the SDK target was generated to" runs: using: "docker" - image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15.32.9" + image: "docker://ghcr.io/speakeasy-api/sdk-generation-action:v15" env: SPEAKEASY_API_KEY: ${{ inputs.speakeasy_api_key }} SPEAKEASY_SERVER_URL: ${{ inputs.speakeasy_server_url }} From 9d9f911b63226334aff627b4c292987a12beeab1 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 16:38:38 -0800 Subject: [PATCH 14/15] feat: update --- internal/actions/runWorkflow.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index f5aaa20b..1f999515 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -307,11 +307,11 @@ func addDirectModeBranchTagging() error { if specificTarget := environment.SpecifiedTarget(); specificTarget != "" { if target, ok := wf.Targets[specificTarget]; ok { if source, ok := wf.Sources[target.Source]; ok && source.Registry != nil { - sources = append(sources, "test") + sources = append(sources, target.Source) } if target.CodeSamples != nil && target.CodeSamples.Registry != nil { - targets = append(targets, "test") + targets = append(targets, specificTarget) } } } else { From 7aa313c5ab85c0d2ae6c09b1131ddfae214342b3 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Mon, 18 Nov 2024 16:39:58 -0800 Subject: [PATCH 15/15] feat: update --- internal/actions/runWorkflow.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index 1f999515..7146eab6 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -283,12 +283,13 @@ func finalize(inputs finalizeInputs) error { } } + inputs.Outputs["commit_hash"] = commitHash + // add merging branch registry tag if err = addDirectModeBranchTagging(); err != nil { return errors.Wrap(err, "failed to tag registry images") } - inputs.Outputs["commit_hash"] = commitHash } return nil