forked from mercedes-benz/sechub
-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (107 loc) · 4.71 KB
/
documentation-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
# SPDX-License-Identifier: MIT
name: Documentation build
on:
workflow_dispatch:
inputs:
publish-documentation:
description: Insert your email address here if you want to create a PR for Github pages update (branch `master`)
required: false
schedule:
# Nightly build documentation:
# cron runs on the default branch: `develop` in our case.
- cron: '32 23 * * *'
env:
ACTIONS_SECHUB_DOC_RELEASE_BRANCH: master
jobs:
build-documentation:
name: build documentation
runs-on: ubuntu-latest
steps:
- name: "Show + check Input and git branch"
run: |
echo "git branch: '${{ github.ref_name }}'"
echo "publish-documentation: '${{ inputs.publish-documentation }}'"
if [ '${{ inputs.publish-documentation }}' != '' -a '${{ github.ref_name }}' != "$ACTIONS_SECHUB_DOC_RELEASE_BRANCH" ] ; then
echo "Aborting run because publishing the documentation must be done on branch '$ACTIONS_SECHUB_DOC_RELEASE_BRANCH'"
echo "Tip: Run this action again and select branch '$ACTIONS_SECHUB_DOC_RELEASE_BRANCH'"
exit 1
fi
- name: Git checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
fetch-tags: true
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/gradle-build-action@8baac4c8ef753599f92eeb509c246d09d6250fa6
with:
cache-read-only: false
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: 1.21.6
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install graphviz (asciidoc diagrams)
run: sudo apt-get --assume-yes install graphviz
# -----------------------------------------
# Build documentation
# -----------------------------------------
- name: Complete build with documentation
run: ./buildDoc
# -----------------------------------------
# Upload documentation
# -----------------------------------------
- name: Archive documentation HTML
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: sechub-docs-html
path: sechub-doc/build/docs/final-html/
retention-days: 14
- name: Archive documentation PDF
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: sechub-docs-pdf
path: sechub-doc/build/docs/asciidoc/*.pdf
retention-days: 14
# -----------------------------------------
# Update and commit documentation for https://mercedes-benz.github.io/sechub/
# -----------------------------------------
- name: Update documentation - publish and commit
if: (inputs.publish-documentation != '') && (github.ref_name == env.ACTIONS_SECHUB_DOC_RELEASE_BRANCH)
run: |
git config user.name "$GITHUB_TRIGGERING_ACTOR (via github-actions)"
git config user.email "${{ inputs.publish-documentation }}"
git reset --hard
sechub-doc/helperscripts/publish+git-add-releasedocs.sh
git commit -m "docs update by '$GITHUB_TRIGGERING_ACTOR' (via github-actions)"
# -----------------------------------------
# Create pull request for documentation update
# -----------------------------------------
- name: Update documentation - Create pull request
if: (inputs.publish-documentation != '') && (github.ref_name == env.ACTIONS_SECHUB_DOC_RELEASE_BRANCH)
id: pr_release_documentation
uses: peter-evans/create-pull-request@c55203cfde3e5c11a452d352b4393e68b85b4533
with:
branch: release-documentation
branch-suffix: short-commit-hash
delete-branch: true
title: '1 - Release documentation [auto-generated]'
body: |
Release of SecHub documentation
-> Please review before merge.
- name: Update documentation - Print PR infos
if: (inputs.publish-documentation != '') && (github.ref_name == env.ACTIONS_SECHUB_DOC_RELEASE_BRANCH)
run: |
echo "Pull Request Number - ${{ steps.pr_release_documentation.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.pr_release_documentation.outputs.pull-request-url }}"