diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38c00e9c5..5f0bce726 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,54 +46,45 @@ jobs: go-version-file: src/go.mod # ---------------------------------------------------------------------------------------------------- - # --- Generate CLI docs ------------------------------------------------------------------------------ + # --- Docs Linting ----------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------- - Generate-CLI-Docs: + Docs-Linting: needs: [Precheck, Checkout] environment: Testing - if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.docfileschanged == 'true' # docsfileschanged also includes srcfileschanged + steps: - uses: actions/checkout@v3 - name: Setup Golang with cache + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' uses: magnetikonline/action-golang-cache@v3 with: go-version-file: src/go.mod - # run the markdown generator - - name: Generate Markdown + - name: Generate CLI Docs + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' working-directory: ./src run: | go run ./cmd/mdgen/mdgen.go generate # migrate generated md files into /docs/docs/cli - name: Move CLI .md to Docs + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' run: | mkdir -p ./docs/docs/cli mv ./src/cmd/mdgen/cli_markdown/* ./docs/docs/cli/ rm -R ./src/cmd/mdgen/cli_markdown/ - uses: actions/upload-artifact@master + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' name: Upload cli docs as artifacts with: name: cli-docs path: docs/docs/cli - # ---------------------------------------------------------------------------------------------------- - # --- Docs Linting ----------------------------------------------------------------------------------- - # ---------------------------------------------------------------------------------------------------- - - Docs-Linting: - needs: [Generate-CLI-Docs] - environment: Testing - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.docfileschanged == 'true' - - steps: - - uses: actions/checkout@v3 - - name: Install dependencies for docs lint run: | wget https://github.com/errata-ai/vale/releases/download/v2.20.2/vale_2.20.2_Linux_64-bit.tar.gz # NOTE: update in Dockerfile when updating @@ -101,12 +92,6 @@ jobs: echo "$PWD/bin" >> $GITHUB_PATH npm i -g markdownlint-cli@0.32.2 # NOTE: update in Dockerfile when updating - - uses: actions/download-artifact@master - name: Download cli docs from build step - with: - name: cli-docs - path: docs/docs/cli - - name: Run docs lint run: | cd docs && make -o genclidocs check