Skip to content

Commit

Permalink
WIP 309 Build GH Pages
Browse files Browse the repository at this point in the history
- Move complete build logic to a new script
- Integrate standalone arc42 docs
- Use HSC itself to check the site
  • Loading branch information
ascheman committed Apr 25, 2024
1 parent 0f161b3 commit 17f59d0
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 18 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,48 @@ name: GitHub Pages

on:
push:
branches:
- main # Set a branch name to trigger deployment
# pull_request:
paths:
- .github/workflows/gh-pages.yml
- src/docs
- self-check
- docToolchainConfig.groovy
- dtcw
- dtcw.bat
- generate-pages
workflow_dispatch: {}

jobs:
deploy:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
env:
DTC_HEADLESS: true
steps:
- uses: actions/checkout@v2
- name: exportExcel
run: ./dtcw exportExcel
- name: generateSite
run: ./dtcw generateSite
- name: removeDraft
run: find build/microsite/output/. -name "*-draft.html" -type f -delete
- name: generatePdf
run: ./dtcw generatePdf
- name: htmlSanityCheck
run: ./dtcw htmlSanityCheck
- name: copyToPublic
run: cp -r ./build/pdf ./build/microsite/output && cp -r ./build/report/htmlchecks ./build/microsite/output && cp -r ./build/microsite/output ./public
- name: Cache .doctoolchain
uses: actions/cache@v2
with:
path: ~/.doctoolchain
key: "${{ runner.os }}-doctoolchain-${{ hashFiles('**/lockfiles') }}"
restore-keys: |
${{ runner.os }}-doctoolchain-
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
# SonarQube requires JDK 17 or higher
java-version: 17

- name: Check out
uses: actions/checkout@v2

- name: Generate Pages
run: ./generate-pages

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
# if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ src/docs/resources/graphics/.DS_Store
.envrc
*.log
tmp/
public/
24 changes: 24 additions & 0 deletions generate-pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

: "${DTC_VERSION:=3.3.1}"
: "${DTC_TASKS:=exportExcel generateHTML generateSite generatePdf}"

# Generate GH Pages with docToolchain
test -d "${HOME}/.doctoolchain/docToolchain-${DTC_VERSION}" || ./dtcw local install doctoolchain
# test -d "${HOME}/.doctoolchain/jdk" || ./dtcw local install java

set -eu

rm -rf build public

./gradlew publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository

./dtcw local "${DTC_TASKS}"
find build/microsite/output/. -name "*-draft.html" -type f -delete
cp -rp ./build/pdf ./build/microsite/output
cp -p ./build/html5/arc42/hsc_arc42.html ./build/microsite/output/arc42/hsc_arc42-standalone.html
cp -rp ./build/html5/images/* ./build/microsite/output/images/
# ./dtcw htmlSanityCheck
(cd self-check && ../gradlew htmlSanityChec)
cp -rp ./build/reports/htmlchecks ./build/microsite/output
cp -rp ./build/microsite/output ./public
44 changes: 44 additions & 0 deletions self-check/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
plugins {
id 'org.aim42.htmlSanityCheck' version "${htmlSanityCheckVersion}"
}

htmlSanityCheck {
sourceDir file("../build/microsite/output")

checkingResultsDir = file("../build/reports/htmlchecks")

httpSuccessCodes = [ 429 ]

logger.quiet "HSC version: ${htmlSanityCheckVersion}"
logger.quiet "HSC sourceDir: ${sourceDir.absolutePath}"
logger.quiet "HSC checkingResultsDir: ${checkingResultsDir.absolutePath}"
}

/*
* Copyright Gerd Aschemann and aim42 contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
1 change: 1 addition & 0 deletions self-check/gradle.properties
37 changes: 37 additions & 0 deletions self-check/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
pluginManagement {
repositories {
maven { url = "file:../build/maven-repo"}
mavenCentral()
}
}

rootProject.name = 'self-check'

/*
* Copyright Gerd Aschemann and aim42 contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/

0 comments on commit 17f59d0

Please sign in to comment.