Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/_test-techdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
pull_request:
branches:
- main
paths:
- ".github/workflows/_test-techdocs.yaml"
- ".github/workflows/techdocs-publish.yaml"
- "tests/techdocs/**"

jobs:
test_techdocs_generate:
name: Test TechDocs Generate
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests/techdocs
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Install techdocs-cli
run: npm install -g @techdocs/cli

- name: Generate TechDocs
run: techdocs-cli generate --no-docker

- name: Verify output
run: |
test -d site
test -f site/index.html
85 changes: 85 additions & 0 deletions .github/workflows/techdocs-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish TechDocs to S3
on:
workflow_call:
inputs:
entity_name:
description: "Backstage entity name (e.g. dai-handbook)"
type: string
required: true
entity_namespace:
description: "Backstage entity namespace"
type: string
default: "default"
entity_kind:
description: "Backstage entity kind"
type: string
default: "Component"
requirements_file:
description: "Path to the requirements.txt file"
type: string
default: "requirements.txt"
python_version:
description: "Python version"
type: string
default: "3.x"
node_version:
description: "Node version for techdocs-cli"
type: string
default: "20"
s3_bucket_name:
description: "S3 bucket name for TechDocs storage"
type: string
required: true
aws_region:
description: "AWS region"
type: string
default: "eu-west-1"
aws_role_arn:
description: "AWS OIDC role ARN for assuming credentials"
type: string
required: true

jobs:
publish:
name: Build & Publish TechDocs
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python_version }}

- name: Set up Node ${{ inputs.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r ${{ inputs.requirements_file }}

- name: Install techdocs-cli
run: npm install -g @techdocs/cli

- name: Build TechDocs
run: techdocs-cli generate --no-docker

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.aws_role_arn }}
aws-region: ${{ inputs.aws_region }}

- name: Publish TechDocs
run: |
techdocs-cli publish \
--publisher-type awsS3 \
--storage-name ${{ inputs.s3_bucket_name }} \
--entity ${{ inputs.entity_namespace }}/${{ inputs.entity_kind }}/${{ inputs.entity_name }}
102 changes: 102 additions & 0 deletions docs/workflows/techdocs-publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
title: Publish TechDocs to S3
---

## Description

<!-- action-docs-inputs source=".github/workflows/techdocs-publish.yaml" -->
### Inputs

| name | description | type | required | default |
| --- | --- | --- | --- | --- |
| `entity_name` | <p>Backstage entity name (e.g. dai-handbook)</p> | `string` | `true` | `""` |
| `entity_namespace` | <p>Backstage entity namespace</p> | `string` | `false` | `default` |
| `entity_kind` | <p>Backstage entity kind</p> | `string` | `false` | `Component` |
| `requirements_file` | <p>Path to the requirements.txt file</p> | `string` | `false` | `requirements.txt` |
| `python_version` | <p>Python version</p> | `string` | `false` | `3.x` |
| `node_version` | <p>Node version for techdocs-cli</p> | `string` | `false` | `20` |
| `s3_bucket_name` | <p>S3 bucket name for TechDocs storage</p> | `string` | `true` | `""` |
| `aws_region` | <p>AWS region</p> | `string` | `false` | `eu-west-1` |
| `aws_role_arn` | <p>AWS OIDC role ARN for assuming credentials</p> | `string` | `true` | `""` |
<!-- action-docs-inputs source=".github/workflows/techdocs-publish.yaml" -->

<!-- action-docs-outputs source=".github/workflows/techdocs-publish.yaml" -->

<!-- action-docs-outputs source=".github/workflows/techdocs-publish.yaml" -->

<!-- action-docs-usage source=".github/workflows/techdocs-publish.yaml" project="dnd-it/github-workflows/.github/workflows/techdocs-publish.yaml" version="v2" -->
### Usage

```yaml
jobs:
job1:
uses: dnd-it/github-workflows/.github/workflows/techdocs-publish.yaml@v2
with:
entity_name:
# Backstage entity name (e.g. dai-handbook)
#
# Type: string
# Required: true
# Default: ""

entity_namespace:
# Backstage entity namespace
#
# Type: string
# Required: false
# Default: default

entity_kind:
# Backstage entity kind
#
# Type: string
# Required: false
# Default: Component

requirements_file:
# Path to the requirements.txt file
#
# Type: string
# Required: false
# Default: requirements.txt

python_version:
# Python version
#
# Type: string
# Required: false
# Default: 3.x

node_version:
# Node version for techdocs-cli
#
# Type: string
# Required: false
# Default: 20

s3_bucket_name:
# S3 bucket name for TechDocs storage
#
# Type: string
# Required: true
# Default: ""

aws_region:
# AWS region
#
# Type: string
# Required: false
# Default: eu-west-1

aws_role_arn:
# AWS OIDC role ARN for assuming credentials
#
# Type: string
# Required: true
# Default: ""
```
<!-- action-docs-usage source=".github/workflows/techdocs-publish.yaml" project="dnd-it/github-workflows/.github/workflows/techdocs-publish.yaml" version="v2" -->

## Example

## FAQ
3 changes: 3 additions & 0 deletions tests/techdocs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TechDocs Test

This is a test page for the TechDocs publish workflow.
5 changes: 5 additions & 0 deletions tests/techdocs/mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
site_name: TechDocs Test
docs_dir: docs/

plugins:
- techdocs-core
2 changes: 2 additions & 0 deletions tests/techdocs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mkdocs~=1.6.1
mkdocs-techdocs-core~=1.4.2
Loading