-
Notifications
You must be signed in to change notification settings - Fork 88
127 lines (119 loc) · 3.65 KB
/
build.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Build
on:
push:
branches: [main]
tags:
- 'v*'
pull_request:
permissions:
contents: read
pages: write
id-token: write
jobs:
attack_flow_builder:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '19'
- name: Install dependencies
working-directory: ./src/attack_flow_builder/
run: npm ci
- name: Build
working-directory: ./src/attack_flow_builder/
env:
# Workaround for node.js bug: https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS: "--openssl-legacy-provider"
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: attack_flow_builder
path: src/attack_flow_builder/dist/
docs:
needs: attack_flow_builder
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- uses: actions/setup-node@v3
with:
node-version: '19'
- name: Update APT
run: sudo apt update
- name: Install APT dependencies
run: sudo apt install graphviz
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org/ | python -
- name: Add Poetry to PATH
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install Python dependencies
run: poetry install
- name: Install Node dependencies
working-directory: ./src/attack_flow_builder/
run: npm ci
- name: Install Mermaid
run: npm install -g @mermaid-js/mermaid-cli
- name: Create client directory
run: mkdir docs/extra/ui
- name: Download Attack Flow Builder
uses: actions/download-artifact@v3
with:
name: attack_flow_builder
path: docs/extra/ui
- name: Make Attack Flow schema
run: poetry run make docs-schema
- name: Validate Corpus
env:
# Workaround for node.js bug: https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS: "--openssl-legacy-provider"
run: poetry run make validate
- name: Copy corpus into docs
env:
# Workaround for node.js bug: https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS: "--openssl-legacy-provider"
run: poetry run make docs-examples
- name: Copy matrix-viz code into docs
run: poetry run make docs-matrix
- name: Build HTML docs
run: poetry run sphinx-build -M dirhtml docs docs/_build -W --keep-going
- name: Upload HTML docs
uses: actions/upload-artifact@v3
with:
name: attack_flow_docs_html
path: docs/_build/dirhtml/
- name: Install TeX Live
run: sudo apt install -y latexmk texlive texlive-latex-extra
- name: Build PDF docs
run: poetry run sphinx-build -M latexpdf docs docs/_build
- name: Upload PDF docs
uses: actions/upload-artifact@v3
with:
name: attack_flow_docs_pdf
path: docs/_build/latex/attackflow.pdf
github_pages:
# This job only runs when committing or merging to main branch.
if: startsWith(github.ref, 'refs/tags/v')
needs: docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Download HTML docs
uses: actions/download-artifact@v3
with:
name: attack_flow_docs_html
path: docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1