Skip to content

Documentation build #434

Documentation build

Documentation build #434

# 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@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-tags: true
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0
with:
cache-read-only: false
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
with:
go-version: 1.21.6
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
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 website and 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@5e914681df9dc83aa4e4905692ca88beb2f9e91f
with:
branch: release-documentation
branch-suffix: short-commit-hash
delete-branch: true
title: '1 - Release website and documentation [auto-generated]'
body: |
Release of SecHub website and 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 }}"