Introduction
An overview of the solution to create a web site from a GitHub repo’s documentation.
Assumptions
The source repo has documentation in markdown files
The source repo was created following our workflow approach and therefore has the necessary subscription id, client id and client secret repo secrets (TF_SUBSCRIPTION_ID, TF_CLIENT_ID, TF_CLIENT_SECRET)
The documentation can be successfully built locally with the Sphinx tooling. See
documentation/how-tos/publish-markdown-with-sphinx
in this repo.If you want to have a custom domain for your site, you will need to request that separately.
Site Provisioning
The site is provisioned as an Azure WebApp using our standard Terraform-based approach.
Repo: ets-ses-docs
The Terraform provisions:
rg-etsdocs-dev-001 Resource Group
asp-etsdocs-plan App Service Plan
Multiple web apps within the App Service Plan. For example, for this repo it is app-etsdocs-gdct
Each Web App running in the App Service Plan is:
SKU: Standard (S1) See Microsoft pricing
Operating System: Windows
Runtime Stack: Node 18 LTS
Publishing Model: Code
Instance Count: 1
Default domain provisioned is https://app-etsdocs-[appname].azurewebsites.net
Note: An alternate approach is to integrate with GitHub Pages. Unfortunately, pages published on GitHub Pages are public. We cannot have Seagen internal documents on the public web.
Onboarding a Repo
Once a repo can successfully build sphinx documentation locally (see Assumptions above), the steps to onboard it to publish documentation to a web site are:
Terraform
Append the name of the site to the Terraform list variable
apps
for the ets Terraform workspaces. For example, for dev: ets-ses-docs-devApply the Terraform by running the deployment workflow. Verify the site is created in Azure (will be empty content for now).
Download the publish profile for your web app in the Azure Portal. Note: It’s a different publish profile per environment. If you are only publishing from your
main
branch, you only need to download the prod web-app profile.
Documentation Deployment
Copy the GitHub workflow
sphinx.yml
from this repo to the workflow directory of the source repo.Modifications to make to the destination
sphinx.yml
:
If you are using a documentation directory
src/docs
, you can skip this step.
Thepaths
to the docs in thepush:
trigger need to match the location of the documentation path in the repo. Likewise, the source directory for thesphinx-build
command in thebuild-sphinx
step also needs to match the location of the documentation path in the repo. (Hint: find/replacesrc/docs
with whatever the path to your docs is)The
app-name
suffix in thepublish-docs
step needs to match the name of what was setup in Terraform step 1 above.In your repo, navigate to the Settings page. Under “Secrets and variables | Actions”, create an “environment secret” called
DOCS_PUBLISHING_PROFILE
. This is a per-environment secret. Set it up for at least yourprd
environment. Copy the contents of the publishing profile as the secret value.
EXAMPLE
I want to deploy documentation for my app spaceship
.
Terraform:
I append “spaceship” to the list of variables in Terraform: [“gdct”,”launchpad”,”spaceship”]
Run the workflow to create a new web app in Azure called
app-etsdocs-spaceship
Verify that the site https://app-etsdocs-spaceship.azurewebsites.net is available. Can also look at Azure Portal’s asp-etsdocs-plan App Service Plan.
Within the Azure Portal, I download the publishing profile for your newly-deployed web app.
Deployment:
Back in my source repo with the documentation, my docs are all under a
src/docs
directory off the root. I’ve already verified sphinx builds it successfully and it looks great on my local box when I open the generated site content. I copy thesphinx.yml
to my.github/workflows
directory.In
sphinx.yml
, I modify theapp-name
underpublish-docs
to beapp-etsdocs-spaceship
to match what is provisioned in Azure.In my repo, I create a new environment secret
DOCS_PUBLISHING_PROFILE
for mydev
environment and another for myprd
environment. I paste the contents of the appropriate downloaded publish profile into the secret value and save the secret.I merge
sphinx.yml
into thedevelopment
branch and it executes. I verify my content displays correctly on my site.I don’t want to deploy from
development
in the future, only from merges tomain
to I update mypush: | branches:
section accordingly.