From e1b2691febd3bd4772eeb4685d611d54d11cb575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Denoix?= Date: Thu, 4 Aug 2022 16:46:58 +0200 Subject: [PATCH] Automatically publish the docs .yml files on release (#20) --- .github/workflows/releases.yml | 28 ++++++++++++++-------------- Makefile | 12 ++++++------ pkg/cmdutil/jsonpath_flags.go | 2 ++ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 5b0c4e2c..6f8a1b98 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -27,17 +27,17 @@ jobs: args: release env: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} - # - name: Docs checkout - # uses: actions/checkout@v3 - # with: - # repository: algolia/cli-docs - # path: docs - # fetch-depth: 0 - # token: ${{secrets.GORELEASER_GITHUB_TOKEN}} - # - name: Update docs - # env: - # GIT_COMMITTER_NAME: algolia-ci - # GIT_AUTHOR_NAME: algolia-ci - # GIT_COMMITTER_EMAIL: noreply@algolia.com - # GIT_AUTHOR_EMAIL: noreply@algolia.com - # run: make docs-bump \ No newline at end of file + - name: Docs checkout + uses: actions/checkout@v3 + with: + repository: algolia/doc + path: docs + fetch-depth: 0 + token: ${{secrets.GORELEASER_GITHUB_TOKEN}} + - name: Update docs + env: + GIT_COMMITTER_NAME: algolia-ci + GIT_AUTHOR_NAME: algolia-ci + GIT_COMMITTER_EMAIL: noreply@algolia.com + GIT_AUTHOR_EMAIL: noreply@algolia.com + run: make docs-bump \ No newline at end of file diff --git a/Makefile b/Makefile index 6643c680..af5228a1 100644 --- a/Makefile +++ b/Makefile @@ -5,15 +5,15 @@ test: ## Build & publish the documentation docs: - git clone https://github.com/algolia/cli-docs.git "$@" + git clone https://github.com/algolia/doc.git "$@" docs-bump: docs git -C docs pull - git -C docs rm 'algolia_*.md' 2>/dev/null || true - go run ./cmd/docs --doc-path docs - rm -f docs/*.bak - git -C docs add 'algolia*.md' - git -C docs commit -m 'update docs' || true + git -C docs checkout feat/cli + git -C docs rm 'app_data/cli/commands/*.yml' 2>/dev/null || true + go run ./cmd/docs --app_data-path docs/app_data/cli/commands + git -C docs add 'app_data/cli/commands/*.yml' + git -C docs commit -m 'update cli commands app data' || true git -C docs push .PHONY: docs-bump diff --git a/pkg/cmdutil/jsonpath_flags.go b/pkg/cmdutil/jsonpath_flags.go index 94efac52..cb2ad440 100644 --- a/pkg/cmdutil/jsonpath_flags.go +++ b/pkg/cmdutil/jsonpath_flags.go @@ -104,10 +104,12 @@ func (f *JSONPathPrintFlags) ToPrinter(templateFormat string) (printers.Printer, func (f *JSONPathPrintFlags) AddFlags(c *cobra.Command) { if f.TemplateArgument != nil { c.Flags().StringVar(f.TemplateArgument, "template", *f.TemplateArgument, "Template string or path to template file to use when --output=jsonpath, --output=jsonpath-file.") + _ = c.Flags().SetAnnotation("template", "IsPrint", []string{"true"}) _ = c.MarkFlagFilename("template") } if f.AllowMissingKeys != nil { c.Flags().BoolVar(f.AllowMissingKeys, "allow-missing-template-keys", *f.AllowMissingKeys, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.") + _ = c.Flags().SetAnnotation("allow-missing-template-keys", "IsPrint", []string{"true"}) } }