-
Notifications
You must be signed in to change notification settings - Fork 6
111 lines (96 loc) · 3.05 KB
/
docs.yml
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
104
105
106
107
108
109
110
111
name: docs-release-pipeline
on:
push:
branches:
- master
paths:
- 'docs/**'
tags:
- '*'
jobs:
get-filenames:
runs-on: ubuntu-latest
outputs:
filenames: ${{ steps.create-filenames-array.outputs.json }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Store AsyncAPI document filenames in a JSON array
id: create-filenames-array
run: |
JSON="{"\""docs"\"":$(ls docs | sed -e 's/\.yaml$//' | jq -R -s -c 'split("\n")[:-1]')}"
echo $JSON
echo $JSON | jq .
echo "::set-output name=json::$JSON"
check-filenames:
runs-on: ubuntu-latest
needs: get-filenames
steps:
- name: Install json2yaml
run: |
sudo npm install -g json2yaml
- name: Check filenames JSON array definition
run: |
matrix='${{ needs.get-filenames.outputs.filenames }}'
echo $matrix
echo $matrix | jq .
echo $matrix | json2yaml
verify-docs:
runs-on: ubuntu-latest
needs: [get-filenames, check-filenames]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-filenames.outputs.filenames) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Validating AsyncAPI document
uses: WaleedAshraf/[email protected]
with:
filepath: "docs/${{ matrix.docs }}.yaml"
build-markdown-docs:
runs-on: ubuntu-latest
needs: [get-filenames, verify-docs]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-filenames.outputs.filenames) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generating Markdown AsyncAPI document
uses: docker://asyncapi/github-action-for-generator:2.0.0
with:
template: '@asyncapi/[email protected]'
filepath: 'docs/${{ matrix.docs }}.yaml'
parameters: outFilename=README.md
output: "experiments/${{ matrix.docs }}"
- name: Add & Commit
uses: EndBug/[email protected]
with:
author_name: Litmus Bot
committer_email: [email protected]
message: 'Updated README docs for ${{ matrix.docs }} experiment'
build-html-docs:
runs-on: ubuntu-latest
needs: [verify-docs]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: '14'
- name: Build HTML Docs
run: |
npm install -g @asyncapi/generator
mkdir html-docs
for filepath in docs/*; do
ag $filepath @asyncapi/html-template -o html-docs -p singleFile=true -p outFilename=$(basename $filepath | sed -e 's/\.yaml$//').html --force-write
done
- name: Publish HTML Docs to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: html-docs