-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
104 lines (95 loc) · 3.26 KB
/
action.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
103
name: Publish Techdocs
description: Action to build and publish techdocs
inputs:
azure-container-name:
description: Name of the Azure container where the techdocs will be published
required: false
default: techdocs
azure-storage-account-name:
description: Name of the Azure storage account where the techdocs will be published
required: false
default: beezinternal
azure-tenant-id:
description: Tenant ID of the Azure storage account where the techdocs will be published
required: false
default: c841f8a8-bd5c-4fef-812b-be529c35e6b0
azure-client-id:
description: Client ID of the Azure storage account where the techdocs will be published
required: true
azure-client-secret:
description: Client secret of the Azure storage account where the techdocs will be published
required: true
is-child:
description: Whether this repo is the child repo
required: false
default: "false"
pat:
description: PAT for accessing the other repo
required: false
head-branch:
description: Name of the HEAD branch
required: false
parent-repo:
description: Name of the parent repo
required: false
runs:
using: composite
steps:
- name: Trigger Parent Event
if: inputs.is-child == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ inputs.pat }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: 'beezlabs-org',
repo: '${{ inputs.parent-repo }}',
workflow_id: 'publish-docs.yaml',
ref: '${{ inputs.head-branch }}'
})
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ inputs.pat || github.token }}
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install techdocs-cli
run: |
npm i -g @techdocs/cli
shell: bash
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install mkdocs and mkdocs plugins
run: |
pip install mkdocs-techdocs-core==1.*
pip install mkdocs-monorepo-plugin==1.*
pip install mkdocs-kroki-plugin
pip install mkdocs-material==9.*
shell: bash
- name: Generate docs
run: |
techdocs-cli generate --no-docker --verbose
shell: bash
- name: Get Entity Information
run: |
echo "ENTITY_NAME=$(yq 'select(di == 0).metadata.name' ./catalog-info.yaml)" >> $GITHUB_ENV
echo "ENTITY_NAMESPACE=$(yq 'select(di == 0).metadata.namespace' ./catalog-info.yaml | sed 's/^null$/default/')" >> $GITHUB_ENV
echo "ENTITY_KIND=$(yq 'select(di == 0).kind' ./catalog-info.yaml)" >> $GITHUB_ENV
shell: bash
- name: Publish docs
env:
AZURE_TENANT_ID: ${{ inputs.azure-tenant-id }}
AZURE_CLIENT_ID: ${{ inputs.azure-client-id }}
AZURE_CLIENT_SECRET: ${{ inputs.azure-client-secret }}
run: |
techdocs-cli publish \
--publisher-type azureBlobStorage \
--storage-name ${{ inputs.azure-container-name }} \
--azureAccountName ${{ inputs.azure-storage-account-name }} \
--entity $ENTITY_NAMESPACE/$ENTITY_KIND/$ENTITY_NAME
shell: bash