From 92967200822ea72f18d4bc75193880447e66ecc5 Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:32:47 -0500 Subject: [PATCH 1/4] add catalog-info.yaml --- catalog-info.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 catalog-info.yaml diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 000000000..89ec07a86 --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,12 @@ +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: terraform-provider-hcp-internal + description: HCP Terraform Provider Internal code and docsite + annotations: + github.com/project-slug: hashicorp/terraform-provider-hcp-internal + backstage.io/techdocs-ref: dir:. +spec: + type: documentation + lifecycle: production + owner: cloud-experiences From cfb4e4e20b47ff3a06b7965c83a1633435a33f16 Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:33:04 -0500 Subject: [PATCH 2/4] add mkdocs.yml --- mkdocs.yml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 mkdocs.yml diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 000000000..66cfe4839 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,47 @@ +site_name: terraform-provider-hcp-internal +site_description: 'HCP Terraform Provider Internal Internal' +copyright: Hashicorp +repo_name: hashicorp/hcp-sdk-go-internal +repo_url: https://github.com/hashicorp/terraform-provider-hcp-internal +edit_uri: "https://github.com/hashicorp/terraform-provider-hcp-internal/tree/main/docs" + +nav: + - Overview: index.md + +theme: + name: material + logo: images/hashicorp.png + favicon: images/hashicorp-black.png + palette: + scheme: hashicorp + primary: black + accent: blue + icon: + repo: fontawesome/brands/github + font: false + features: + - navigation.instant + - content.tabs.link + +plugins: + - techdocs-core + - search: + lang: + - en + +markdown_extensions: + - admonition + - codehilite + - meta + - toc: + permalink: true + - pymdownx.tabbed: + alternate_style: true + - pymdownx.emoji: + emoji_index: !!python/name:materialx.emoji.twemoji + emoji_generator: !!python/name:materialx.emoji.to_svg + - pymdownx.superfences + - abbr + - footnotes + - pymdownx.snippets + - mdx_truly_sane_lists From 4bb45230130592ba06e8277b4105b7693df7623c Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:33:11 -0500 Subject: [PATCH 3/4] add techdocs.yml action --- .github/workflows/techdocs.yml | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/techdocs.yml diff --git a/.github/workflows/techdocs.yml b/.github/workflows/techdocs.yml new file mode 100644 index 000000000..831a94eb3 --- /dev/null +++ b/.github/workflows/techdocs.yml @@ -0,0 +1,54 @@ +name: Publish TechDocs Site + +on: + push: + # cover both bases, as this file is copied to other repos + branches: + - main + - master + # You can even set it to run only when TechDocs related files are updated. + paths: + - "docs/**" + - "mkdocs.yml" + - ".github/workflows/techdocs.yml" + - "README.md" + +permissions: + contents: read + id-token: write # Necessary for doormat-action GHA JWT -> Passport JWT -> Doormat Creds + +jobs: + publish-techdocs-site: + runs-on: ubuntu-latest + + env: + TECHDOCS_S3_BUCKET_NAME: 'hc-backstage-techdocs-prod' + ENTITY_NAMESPACE: 'default' + ENTITY_KIND: 'component' + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + - uses: actions/setup-python@v2 + + - name: Install techdocs-cli + run: sudo npm install -g @techdocs/cli + + - name: Install mkdocs and mkdocs plugins + run: python -m pip install mkdocs-techdocs-core==1.* + + - name: Set env + run: echo "GITHUB_REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" >> $GITHUB_ENV + + - name: Generate docs site + run: techdocs-cli generate --no-docker --verbose + - name: AWS credentials via Doormat + uses: hashicorp/doormat-action@v1 + with: + aws-role-arn: arn:aws:iam::158999680113:role/GHA-s3-docs-hashicorp-${{ env.GITHUB_REPOSITORY_NAME }} + aws-region: us-west-2 + - name: Publish docs site + run: + techdocs-cli publish --publisher-type awsS3 --storage-name $TECHDOCS_S3_BUCKET_NAME --entity $ENTITY_NAMESPACE/$ENTITY_KIND/${{ env.GITHUB_REPOSITORY_NAME }} \ No newline at end of file From 7b339a58b6f83f69d844fd07e60cf4b595dcc016 Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:33:28 -0500 Subject: [PATCH 4/4] add make target to preview docs --- GNUmakefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GNUmakefile b/GNUmakefile index f2894e593..2773bbbbc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -59,3 +59,7 @@ gencheck: (echo; echo "Unexpected difference in directories after code generation. Run 'go generate' command and commit."; exit 1) .PHONY: dev all fmt fmtcheck test testacc depscheck gencheck + +.PHONY: techdocs/preview +techdocs/preview: ## Run Backstage Techdocs locally, to preview the techdocs site + npx @techdocs/cli serve -v \ No newline at end of file