Skip to content

Documentation build #19

Documentation build

Documentation build #19

# 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@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-tags: true
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
with:
cache-read-only: false
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: 1.20.4
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: sechub-docs-html
path: sechub-doc/build/docs/final-html/
retention-days: 14
- name: Archive documentation PDF
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
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@153407881ec5c347639a548ade7d8ad1d6740e38
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 }}"