-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (110 loc) · 3.71 KB
/
jekyll-gh-pages.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
128
129
130
131
132
133
134
135
name: Deploy Security Runbooks to GitHub Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Setup Jekyll
run: |
gem install bundler
bundle install
- name: Create Jekyll structure
run: |
# Create necessary directories
mkdir -p _runbooks _layouts _includes assets/css
# Create runbook layout
cat > _layouts/runbook.html << 'EOL'
---
layout: default
---
<article class="runbook">
<header class="runbook-header">
<h1>{{ page.title }}</h1>
</header>
<div class="runbook-content">
{{ content }}
</div>
<footer class="runbook-footer">
<hr>
<p>
<a href="{{ site.github.repository_url }}/edit/main/{{ page.path }}">Edit this page on GitHub</a>
</p>
</footer>
</article>
EOL
# Process runbook files
for file in runbooks/*.md; do
if [ -f "$file" ] && [ "$(basename "$file")" != "README.md" ]; then
# Get clean title and filename
title=$(basename "$file" .md | sed 's/RunBook//' | sed 's/-/ /g')
newname=$(basename "$file" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g' | sed 's/runbook\.md$/md/' | sed 's/[)(]//g')
# Create new file with front matter
cat > "_runbooks/$newname" << EOL
---
layout: runbook
title: "${title}"
permalink: /runbooks/${newname%.*}/
---
EOL
# Append original content, skipping any existing front matter
if grep -q "^---" "$file"; then
sed -e '1{/^---$/!q;};1,/^---$/d' "$file" >> "_runbooks/$newname"
else
cat "$file" >> "_runbooks/$newname"
fi
fi
done
# Create index page
cat > index.md << 'EOL'
---
layout: default
title: Contrast Security Attack Detection Rules Runbooks
---
# Attack Detection Rules (ADR) Runbooks
Welcome to Contrast Security's Attack Detection Rules (ADR) Runbooks. These guides provide detailed procedures for understanding and responding to various security vulnerabilities detected by Contrast Security.
## Available Runbooks
{% assign sorted_runbooks = site.runbooks | sort: "title" %}
{% for runbook in sorted_runbooks %}
* [{{ runbook.title }}]({{ runbook.url | relative_url }})
{% endfor %}
## Contributing
These runbooks are open source. To contribute:
1. Fork the [repository](https://github.com/Contrast-Security-OSS/adr-runbooks)
2. Make your changes
3. Submit a pull request
EOL
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
run: bundle exec jekyll build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4