Skip to content

feat: upgrade to project_v2 resources #6

feat: upgrade to project_v2 resources

feat: upgrade to project_v2 resources #6

Workflow file for this run

# Workflow for building and deploying MkDocs documentation with Terraform docs to GitHub Pages
name: Deploy Documentation to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: [main]
paths:
- 'docs/**'
- 'mkdocs.yml'
- '*.tf'
- 'modules/**'
- 'schemas/**'
- 'examples/**'
- '.github/workflows/deploy_docs.yml'
pull_request:
types: [opened, synchronize]
paths:
- 'docs/**'
- 'mkdocs.yml'
- '*.tf'
- 'modules/**'
- 'schemas/**'
- 'examples/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
TERRAFORM_DOCS_VERSION: v0.20.0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for git revision dates
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'docs/requirements.txt'
- name: Install MkDocs and dependencies
run: |
pip install -r docs/requirements.txt
- name: Install terraform-docs
run: |
wget -O /tmp/terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/${TERRAFORM_DOCS_VERSION}/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz
tar -xzf /tmp/terraform-docs.tar.gz -C /tmp
sudo mv /tmp/terraform-docs /usr/local/bin/
chmod +x /usr/local/bin/terraform-docs
terraform-docs --version
- name: Generate Terraform documentation
run: |
# Generate main module docs
terraform-docs markdown table . > docs/reference/terraform.md
# Generate submodule docs
for dir in modules/*/; do
module_name=$(basename $dir)
terraform-docs markdown table $dir > docs/reference/module-${module_name}.md
done
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with MkDocs
run: |
mkdocs build --strict --site-dir ./site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
# Deployment job
deploy:
if: github.event_name == 'push' || github.event.pull_request.merged == true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4