Skip to content

Commit

Permalink
Merge pull request #79 from hashicorp/hce-373-backstage
Browse files Browse the repository at this point in the history
HCE-373: set up Backstage
  • Loading branch information
bcmdarroch authored Nov 17, 2022
2 parents 4c9a6ed + 7b339a5 commit b1fbf8f
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/techdocs.yml
Original file line number Diff line number Diff line change
@@ -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 }}
4 changes: 4 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b1fbf8f

Please sign in to comment.