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 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 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 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