-
Notifications
You must be signed in to change notification settings - Fork 6
102 lines (90 loc) · 3.58 KB
/
techdocs-generate-and-publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Publish TechDocs Site
on:
repository_dispatch:
types:
- docs-update
workflow_dispatch:
inputs:
repository:
description: Repository containing documentation
required: true
default: operate-first/apps
type: string
docs_path:
description: Path to documentation within the repository
required: false
type: string
entity_namespace:
description: Backstage entity namespace
required: true
type: string
default: default
entity_kind:
description: Backstage entity kind
required: true
type: string
entity_name:
description: Backstage entity name
required: true
type: string
jobs:
generate-and-publish:
runs-on: ubuntu-latest
env:
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_ENDPOINT: https://s3-openshift-storage.apps.smaug.na.operate-first.cloud
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Parse repository_dispatch
if: ${{ github.event_name == 'repository_dispatch' }}
run: |
echo "DOCS_REPOSITORY=${{ github.event.client_payload.repository }}" >> $GITHUB_ENV
echo "DOCS_PATH=${{ github.event.client_payload.docs_path }}" >> $GITHUB_ENV
echo "ENTITY=${{ github.event.client_payload.entity_namespace }}/${{ github.event.client_payload.entity_kind }}/${{ github.event.client_payload.entity_name }}" >> $GITHUB_ENV
- name: Parse workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "DOCS_REPOSITORY=${{ inputs.repository }}" >> $GITHUB_ENV
echo "DOCS_PATH=${{ inputs.docs_path }}" >> $GITHUB_ENV
echo "ENTITY=${{ inputs.entity_namespace }}/${{ inputs.entity_kind }}/${{ inputs.entity_name }}" >> $GITHUB_ENV
- name: Clone repo
uses: actions/checkout@v3
with:
repository: '${{ env.DOCS_REPOSITORY }}'
- name: Setup node
uses: actions/setup-node@v2
- name: Setup python
uses: actions/setup-python@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: download, validate, install plantuml and its dependencies
run: |
curl -o plantuml.jar -L http://sourceforge.net/projects/plantuml/files/plantuml.1.2021.4.jar/download
echo "be498123d20eaea95a94b174d770ef94adfdca18 plantuml.jar" | sha1sum -c -
mv plantuml.jar /opt/plantuml.jar
mkdir -p "$HOME/.local/bin"
echo $'#!/bin/sh\n\njava -jar '/opt/plantuml.jar' ${@}' >> "$HOME/.local/bin/plantuml"
chmod +x "$HOME/.local/bin/plantuml"
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get install -y graphviz
- name: Install techdocs-cli
run: sudo npm install --location=global @techdocs/cli
- name: Install mkdocs and mkdocs plugins
run: python -m pip install mkdocs-techdocs-core==1.* mkdocs-kroki-plugin
- name: Generate docs site
working-directory: ${{ env.DOCS_PATH }}
run: techdocs-cli generate --no-docker --verbose
- name: Publish docs site
working-directory: ${{ env.DOCS_PATH }}
run: |
echo ${{ env.ENTITY }}
techdocs-cli publish \
--publisher-type awsS3 \
--storage-name $BUCKET_NAME \
--awsEndpoint $AWS_ENDPOINT \
--awsS3ForcePathStyle \
--entity ${{ env.ENTITY }}