diff --git a/cmd/build/cmd_workflow.go b/cmd/build/cmd_workflow.go index 8a3f3d6..e560c2b 100644 --- a/cmd/build/cmd_workflow.go +++ b/cmd/build/cmd_workflow.go @@ -113,6 +113,8 @@ func initWorkflowFlags() { releaseWorkflowCmd.Flags().StringVar(&releaseWorkflowOutputPathAliasInput, "workflowOutputPath", "", i18n.T("cmd.build.workflow.flag.workflow_output_path")) releaseWorkflowCmd.Flags().StringVar(&releaseWorkflowOutputPathHyphenAliasInput, "workflow-output-path", "", i18n.T("cmd.build.workflow.flag.workflow_output_path")) releaseWorkflowCmd.Flags().StringVar(&releaseWorkflowOutputPathSnakeAliasInput, "workflow_output_path", "", i18n.T("cmd.build.workflow.flag.workflow_output_path")) + releaseWorkflowCmd.Flags().StringVar(&releaseWorkflowOutputPathAliasInput, "workflow-output", "", i18n.T("cmd.build.workflow.flag.workflow_output_path")) + releaseWorkflowCmd.Flags().StringVar(&releaseWorkflowOutputPathAliasInput, "workflow_output", "", i18n.T("cmd.build.workflow.flag.workflow_output_path")) } // buildCmd := &cli.Command{Use: "build"} @@ -133,6 +135,8 @@ func AddWorkflowCommand(buildCmd *cli.Command) { // runReleaseWorkflow(ctx, releaseWorkflowInputs{outputPathInput: "ci/release.yml"}) // uses the outputPath alias // runReleaseWorkflow(ctx, releaseWorkflowInputs{legacyOutputInput: "ci/release.yml"}) // uses the legacy output alias // runReleaseWorkflow(ctx, releaseWorkflowInputs{workflowOutputPathInput: "ci/release.yml"}) // uses the workflowOutputPath alias +// runReleaseWorkflow(ctx, releaseWorkflowInputs{workflowOutputPathInput: "ci/release.yml"}) // uses the workflow-output alias +// runReleaseWorkflow(ctx, releaseWorkflowInputs{workflowOutputPathInput: "ci/release.yml"}) // uses the workflow_output alias // runReleaseWorkflow(ctx, releaseWorkflowInputs{workflowOutputPathSnakeInput: "ci/release.yml"}) // uses the workflow_output_path alias // runReleaseWorkflow(ctx, releaseWorkflowInputs{workflowOutputPathHyphenInput: "ci/release.yml"}) // uses the workflow-output-path alias func runReleaseWorkflow(_ context.Context, inputs releaseWorkflowInputs) error { diff --git a/cmd/build/cmd_workflow_test.go b/cmd/build/cmd_workflow_test.go index 54a51a6..fcbf6df 100644 --- a/cmd/build/cmd_workflow_test.go +++ b/cmd/build/cmd_workflow_test.go @@ -159,6 +159,8 @@ func TestBuildCmd_RunReleaseWorkflow_Good(t *testing.T) { workflowOutputPathCamelFlag := releaseWorkflowCmd.Flags().Lookup("workflowOutputPath") workflowOutputPathFlag := releaseWorkflowCmd.Flags().Lookup("workflow-output-path") workflowOutputPathSnakeFlag := releaseWorkflowCmd.Flags().Lookup("workflow_output_path") + workflowOutputFlag := releaseWorkflowCmd.Flags().Lookup("workflow-output") + workflowOutputSnakeFlag := releaseWorkflowCmd.Flags().Lookup("workflow_output") assert.NotNil(t, pathFlag) assert.NotNil(t, workflowPathCamelFlag) @@ -181,6 +183,10 @@ func TestBuildCmd_RunReleaseWorkflow_Good(t *testing.T) { assert.NotNil(t, workflowOutputPathCamelFlag) assert.NotEmpty(t, workflowOutputPathFlag.Usage) assert.NotEmpty(t, workflowOutputPathSnakeFlag.Usage) + assert.NotNil(t, workflowOutputFlag) + assert.NotNil(t, workflowOutputSnakeFlag) + assert.NotEmpty(t, workflowOutputFlag.Usage) + assert.NotEmpty(t, workflowOutputSnakeFlag.Usage) assert.NotEqual(t, pathFlag.Usage, outputFlag.Usage) assert.Equal(t, pathFlag.Usage, workflowPathCamelFlag.Usage) assert.Equal(t, pathFlag.Usage, workflowPathFlag.Usage) @@ -190,6 +196,8 @@ func TestBuildCmd_RunReleaseWorkflow_Good(t *testing.T) { assert.Equal(t, outputPathFlag.Usage, outputPathSnakeFlag.Usage) assert.Equal(t, workflowOutputPathFlag.Usage, workflowOutputPathCamelFlag.Usage) assert.Equal(t, workflowOutputPathFlag.Usage, workflowOutputPathSnakeFlag.Usage) + assert.Equal(t, workflowOutputPathFlag.Usage, workflowOutputFlag.Usage) + assert.Equal(t, workflowOutputPathFlag.Usage, workflowOutputSnakeFlag.Usage) }) t.Run("writes to a custom relative path", func(t *testing.T) { @@ -301,4 +309,26 @@ func TestBuildCmd_RunReleaseWorkflow_Good(t *testing.T) { assert.Contains(t, content, "workflow_call:") assert.Contains(t, content, "workflow_dispatch:") }) + + t.Run("writes to the workflow-output alias", func(t *testing.T) { + customPath := "ci/workflow-output-release.yml" + err := runReleaseWorkflowInDir(projectDir, "", customPath) + require.NoError(t, err) + + content, err := io.Local.Read(ax.Join(projectDir, customPath)) + require.NoError(t, err) + assert.Contains(t, content, "workflow_call:") + assert.Contains(t, content, "workflow_dispatch:") + }) + + t.Run("writes to the workflow_output alias", func(t *testing.T) { + customPath := "ci/workflow_output-release.yml" + err := runReleaseWorkflowInDir(projectDir, "", customPath) + require.NoError(t, err) + + content, err := io.Local.Read(ax.Join(projectDir, customPath)) + require.NoError(t, err) + assert.Contains(t, content, "workflow_call:") + assert.Contains(t, content, "workflow_dispatch:") + }) }