diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 95805f34f..17af4fa21 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -146,3 +146,12 @@ jobs: MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }} MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }} MACOS_NOTARIZATION_APP_PW: ${{ secrets.MACOS_NOTARIZATION_APP_PW }} + + # an action that will ping another repo to trigger a docs build + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.PAT }} + repository: defang-io/defang-docs + event-type: test-deploy + diff --git a/src/cmd/cli/main.go b/src/cmd/cli/main.go index aba52f77a..6ad3476af 100644 --- a/src/cmd/cli/main.go +++ b/src/cmd/cli/main.go @@ -751,11 +751,6 @@ var tosCmd = &cobra.Command{ } func main() { - - if len(os.Args) > 1 && os.Args[1] == "gen-docs" { - gen_docs() - return - } defangFabric := pkg.Getenv("DEFANG_FABRIC", cli.DefaultCluster) defangProvider := cliClient.Provider(pkg.Getenv("DEFANG_PROVIDER", "auto")) @@ -956,6 +951,11 @@ func main() { } flushAllTracking() + + if len(os.Args) > 2 && os.Args[1] == "gen-docs" && os.Args[2] != "" { + gen_docs(os.Args[2]) + return + } } func prettyExecutable(def string) string { @@ -1003,9 +1003,10 @@ func printDefangHint(hint, args string) { } } -func gen_docs() { - // Assume 'rootCmd' is the root of your command tree - err := doc.GenMarkdownTree(rootCmd, "./docs") +func gen_docs(docsPath string) { + _ = os.Mkdir(docsPath, 0755) + + err := doc.GenMarkdownTree(rootCmd, docsPath) if err != nil { log.Fatal(err) }