Skip to content

Commit a36c2b6

Browse files
authored
Merge pull request #8 from Staffbase/techdocs-additional-plugins
✨ Support for additional plugins / skip-publish
2 parents fa6004d + f387285 commit a36c2b6

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The action facilitated [TechDocs CLI](https://backstage.io/docs/features/techdoc
1313

1414
## Usage
1515

16+
### Minimal Example
17+
1618
The following shows a minimal example of building and publishing TechDocs to AWS S3.
1719

1820
```yaml
@@ -25,6 +27,7 @@ on:
2527
paths:
2628
- "docs/**"
2729
- "mkdocs.yml"
30+
- ".github/workflows/techdocs.yml"
2831

2932
jobs:
3033
publish-techdocs-site:
@@ -41,6 +44,33 @@ jobs:
4144
aws-secret-access-key: ${{ secrets.TECHDOCS_AWS_SECRET_ACCESS_KEY }}
4245
```
4346
47+
### Advanced Example
48+
49+
The following will skip the publish step (e.g. to verify site generation in a pull request) and installs additional plugins:
50+
51+
```yaml
52+
name: Publish TechDocs Site
53+
54+
on:
55+
push:
56+
paths:
57+
- "docs/**"
58+
- "mkdocs.yml"
59+
- ".github/workflows/techdocs.yml"
60+
61+
jobs:
62+
publish-techdocs-site:
63+
name: Publish TechDocs Site
64+
runs-on: ubuntu-20.04
65+
steps:
66+
- name: Setup Node
67+
uses: Staffbase/backstage-techdocs-action@v1
68+
with:
69+
entity-name: 'pizza-service'
70+
additional-plugins: 'mkdocs-minify-plugin\>=0.3 mkdocs-awesome-pages-plugin==2.8.0 mdx_include==1.4.2'
71+
skip-publish: 'true'
72+
```
73+
4474
## Configuration
4575
4676
| Name | Description | Required | Default |
@@ -55,6 +85,8 @@ jobs:
5585
| `aws-secret-access-key` | **Required if `publisher-type: awsS3`** - AWS Secret Access Key | `false` | |
5686
| `azure-account-name` | **Required if `publisher-type: azureBlobStorage`** - Azure Account Name | `false` | |
5787
| `azure-account-key` | **Required if `publisher-type: azureBlobStorage`** - Azure Account Key | `false` | |
88+
| `additional-plugins` | Space separated list of additional python plugins (Bash quoting for special chars) | `false` | |
89+
| `skip-publish` | Indicates whether publish step should be skipped | `false` | `false` |
5890

5991
## Contributing
6092

action.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,19 @@ inputs:
3636
azure-account-key:
3737
description: 'Azure Account Name'
3838
required: false
39+
additional-plugins:
40+
description: 'List of additional python plugins to use for site creation'
41+
required: false
42+
skip-publish:
43+
description: 'Indicates whether publish step should be skipped'
44+
required: false
45+
default: 'false'
3946

4047
runs:
4148
using: "composite"
4249
steps:
4350
- name: Setup Node
44-
uses: actions/setup-node@v3.4.1
51+
uses: actions/setup-node@v3
4552

4653
- name: Setup Python
4754
uses: actions/setup-python@v4
@@ -52,14 +59,23 @@ runs:
5259

5360
- name: Install mkdocs and mkdocs plugins
5461
shell: bash
55-
run: python -m pip install mkdocs-techdocs-core==0.*
62+
run: python -m pip install mkdocs-techdocs-core==1.*
63+
64+
- name: Install additional plugins
65+
if: inputs.additional-plugins != ''
66+
shell: bash
67+
run: |
68+
for p in ${{ inputs.additional-plugins }}
69+
do
70+
python -m pip install $p
71+
done
5672
5773
- name: Generate docs site
5874
shell: bash
5975
run: techdocs-cli generate --no-docker --verbose
6076

6177
- name: Publish TechDocs site to AWS S3
62-
if: inputs.publisher-type == 'awsS3' && inputs.aws-access-key-id != '' && inputs.aws-secret-access-key != '' && inputs.aws-region != ''
78+
if: inputs.skip-publish == 'false' && inputs.publisher-type == 'awsS3' && inputs.aws-access-key-id != '' && inputs.aws-secret-access-key != '' && inputs.aws-region != ''
6379
shell: bash
6480
env:
6581
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
@@ -71,7 +87,7 @@ runs:
7187
--entity ${{ inputs.entity-namespace }}/${{ inputs.entity-kind }}/${{ inputs.entity-name }}
7288
7389
- name: Publish TechDocs site to Azure Blob
74-
if: inputs.publisher-type == 'azureBlobStorage' && inputs.azure-account-name != '' && inputs.azure-account-key != ''
90+
if: inputs.skip-publish == 'false' && inputs.publisher-type == 'azureBlobStorage' && inputs.azure-account-name != '' && inputs.azure-account-key != ''
7591
shell: bash
7692
run: |
7793
techdocs-cli publish --publisher-type ${{ inputs.publisher-type }} \

catalog-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ metadata:
1010
- backstage
1111
spec:
1212
type: other
13-
lifecycle: experimental
13+
lifecycle: production

0 commit comments

Comments
 (0)