Added master to CI
Build Successful The Ravenous rulebook, master handbook, and balance report were built successfully.
Ravenous/ravenous_typst/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-08-22 18:55:04 +02:00
parent 16c6205f62
commit 244744ea92
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
1 changed files with 41 additions and 9 deletions

50
Jenkinsfile vendored
View File

@ -11,6 +11,11 @@ pipeline {
BALANCE_SOURCE_FILE = "balance_report.typ"
BALANCE_OUTPUT_FILE = "Ravenous_balance_report_build.pdf"
BALANCE_PUBLISHED_FILE = "Ravenous_balance_report.pdf"
MASTER_SOURCE_FILE = "master_handbook.typ"
MASTER_PLAINTEXT_FILE = "Ravenous_master_handbook_plaintext.pdf"
MASTER_OUTPUT_FILE = "Ravenous_master_handbook_build.pdf"
MASTER_PUBLISHED_FILE = "Ravenous_master_handbook.pdf"
MASTER_PASSWORD = "billy"
// Important: published books live under /mnt/books
DEPLOY_DIR = "/mnt/books/Ravenous"
@ -49,6 +54,13 @@ pipeline {
echo "Using:"
typst --version
if ! command -v qpdf >/dev/null 2>&1; then
echo "qpdf is required to protect the master handbook." >&2
exit 1
fi
qpdf --version
'''
}
}
@ -67,11 +79,26 @@ pipeline {
echo "Building ${BALANCE_SOURCE_FILE} -> ${BALANCE_OUTPUT_FILE}"
typst compile "${BALANCE_SOURCE_FILE}" "${BALANCE_OUTPUT_FILE}"
echo "Building ${MASTER_SOURCE_FILE} -> ${MASTER_PLAINTEXT_FILE}"
typst compile "${MASTER_SOURCE_FILE}" "${MASTER_PLAINTEXT_FILE}"
echo "Protecting the master handbook (password: ${MASTER_PASSWORD})"
qpdf --allow-weak-crypto \
--encrypt "${MASTER_PASSWORD}" "${MASTER_PASSWORD}" 40 -- \
"${MASTER_PLAINTEXT_FILE}" "${MASTER_OUTPUT_FILE}"
test -f "${OUTPUT_FILE}"
test -f "${BALANCE_OUTPUT_FILE}"
test -f "${MASTER_OUTPUT_FILE}"
# Never archive or publish the unprotected intermediate.
rm "${MASTER_PLAINTEXT_FILE}"
echo "Builds complete:"
ls -lh "${OUTPUT_FILE}" "${BALANCE_OUTPUT_FILE}"
ls -lh \
"${OUTPUT_FILE}" \
"${BALANCE_OUTPUT_FILE}" \
"${MASTER_OUTPUT_FILE}"
'''
}
}
@ -79,7 +106,7 @@ pipeline {
stage('Archive PDFs') {
steps {
archiveArtifacts(
artifacts: "${OUTPUT_FILE},${BALANCE_OUTPUT_FILE}",
artifacts: "${OUTPUT_FILE},${BALANCE_OUTPUT_FILE},${MASTER_OUTPUT_FILE}",
fingerprint: true
)
}
@ -127,12 +154,12 @@ pipeline {
publishChecks(
conclusion: 'SUCCESS',
name: 'Build Successful',
summary: 'The Ravenous rulebook and balance report were built successfully.',
text: 'The rulebook and balance report were compiled and published successfully.',
summary: 'The Ravenous rulebook, master handbook, and balance report were built successfully.',
text: 'All three PDFs were compiled and published successfully.',
title: 'Build Successful'
)
echo '✅ Ravenous book and balance report built and published!'
echo '✅ Ravenous books and balance report built and published!'
}
failure {
@ -140,7 +167,7 @@ pipeline {
conclusion: 'FAILURE',
name: 'Build Failed',
summary: 'A Ravenous PDF build or deployment failed.',
text: 'Rulebook or balance-report compilation/publication failed.',
text: 'Rulebook, master-handbook, or balance-report compilation/publication failed.',
title: 'Build Failed'
)
@ -166,7 +193,7 @@ pipeline {
* Publish the generated Ravenous PDFs.
*
* Build artifacts retain explicit CI names in Jenkins, while published copies
* use stable rulebook and balance-report names.
* use stable rulebook, master-handbook, and balance-report names.
*
* @param targetDir Directory receiving the compiled book.
*/
@ -174,7 +201,7 @@ def deployTo(String targetDir) {
sh """
set -e
echo "Publishing Ravenous and its balance report to ${targetDir}"
echo "Publishing Ravenous, its master handbook, and its balance report to ${targetDir}"
mkdir -p "${targetDir}"
@ -186,9 +213,14 @@ def deployTo(String targetDir) {
"${env.BALANCE_OUTPUT_FILE}" \
"${targetDir}/${env.BALANCE_PUBLISHED_FILE}"
rsync -a \
"${env.MASTER_OUTPUT_FILE}" \
"${targetDir}/${env.MASTER_PUBLISHED_FILE}"
echo "Published:"
ls -lh \
"${targetDir}/${env.PUBLISHED_FILE}" \
"${targetDir}/${env.BALANCE_PUBLISHED_FILE}"
"${targetDir}/${env.BALANCE_PUBLISHED_FILE}" \
"${targetDir}/${env.MASTER_PUBLISHED_FILE}"
"""
}