forked from OWASP/owasp-mastg
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (115 loc) · 4.52 KB
/
docgenerator.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
136
137
138
139
140
141
142
name: Documents Build
on:
workflow_dispatch:
pull_request:
paths:
- 'Document/**.md'
push:
branches:
- master
tags:
- v*.*.*
paths:
- 'Document/**.md'
jobs:
Generate-MASTG-Documents:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r src/scripts/requirements.txt
- name: Set MASTG_VERSION to env
run: echo "MASTG_VERSION=$(curl "https://api.github.com/repos/OWASP/owasp-mastg/tags" | jq -r '.[0].name')" >> $GITHUB_ENV
- name: Set DEV MASTG_VERSION if it's not a tag
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: echo "MASTG_VERSION=${{env.MASTG_VERSION}}-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Get Latest MASVS Release Tag
run: echo "MASVS_VERSION=$(curl -s https://api.github.com/repos/OWASP/owasp-masvs/releases/latest | jq '.tag_name' | sed 's/\"//g')" >> $GITHUB_ENV
- name: Assemble Chapters
run: python3 src/scripts/assemble_chapters_for_pdf.py
- name: Generate English PDF
run: ./src/pandocker/pandoc_makedocs.sh Document ${{env.MASTG_VERSION}} ${{env.MASVS_VERSION}}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OWASP_MASTG
path: OWASP_MASTG*
Generate-Checklists:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r src/scripts/requirements.txt
- name: Set MASTG_VERSION to env
# run: echo "MASTG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV
run: echo "MASTG_VERSION=$(curl -s https://api.github.com/repos/OWASP/owasp-mastg/tags | jq '.[0].name' | sed 's/\"//g')" >> $GITHUB_ENV
- name: Set DEV VERSION if it's not a tag
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: echo "MASTG_VERSION=${{env.MASTG_VERSION}}-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Confirm MASTG Current Tag
run: echo ${{env.MASTG_VERSION}}
- name: Get MASTG Current Commit ID
run: echo "MASTG_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Confirm MASTG Current Commit ID
run: echo ${{env.MASTG_COMMIT}}
- name: Get Latest MASVS Release Tag
run: echo "MASVS_VERSION=$(curl -s https://api.github.com/repos/OWASP/owasp-masvs/releases/latest | jq '.tag_name' | sed 's/\"//g')" >> $GITHUB_ENV
- name: Confirm MASVS Release Tag
run: echo ${{env.MASVS_VERSION}}
- uses: actions/checkout@v4
with:
repository: "OWASP/owasp-masvs.git"
ref: ${{env.MASVS_VERSION}}
fetch-depth: 1
path: owasp-masvs
- name: Get MASVS Current Commit ID
run: cd owasp-masvs && echo "MASVS_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Confirm MASTG Current Commit ID
run: echo ${{env.MASVS_COMMIT}}
- name: Generate Excel
run: python3 src/scripts/yaml_to_excel.py --mastgversion ${{env.MASTG_VERSION}} --mastgcommit ${{env.MASTG_COMMIT}} --masvsversion ${{env.MASVS_VERSION}} --masvscommit ${{env.MASVS_COMMIT}}
# - name: Upload Enhanced MASVS YAML
# uses: actions/upload-artifact@v3
# with:
# name: Enhanced-MASVS-YAML-Files
# path: src/scripts/masvs_full_*.yaml
- name: Upload Checklists
uses: actions/upload-artifact@v4
with:
name: Checklists
path: OWASP_MAS_Checklist*.xlsx
release:
runs-on: ubuntu-latest
needs: [Generate-MASTG-Documents, Generate-Checklists]
if: startsWith(github.ref, 'refs/tags/') && (github.actor == 'cpholguera' || github.actor == 'sushi2k')
steps:
- uses: actions/download-artifact@v4
- name: List Downloaded document (sampling of download-artifact)
run: ls -l OWASP_MASTG*
- name: print working directory
run: pwd
- name: Listing of root directory
run: ls -l
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: false
draft: true
generate_release_notes: true
discussion_category_name: Announcements
files: |
OWASP_MASTG/OWASP_MASTG.pdf
OWASP_MASTG/OWASP_MASTG.epub
Checklists/*.xlsx
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}