d10_cs_generator/Jenkinsfile

61 lines
1.8 KiB
Groovy

pipeline {
agent any
options {
skipDefaultCheckout(true)
timestamps()
}
environment {
DEPLOY_DIR = '/mnt/books/RPG/d10_character_sheet'
}
stages {
stage('Checkout') {
steps {
deleteDir()
checkout scm
}
}
stage('Dependencies') {
steps {
sh 'python3 -m venv .venv'
sh '.venv/bin/python -m pip install -r requirements.txt'
}
}
stage('Build and verify') {
steps {
sh '.venv/bin/python -m unittest discover -s tests -v'
sh '.venv/bin/python tools/publish_builds.py'
sh '''
if command -v node >/dev/null 2>&1; then
D10_BUILD_ROOT=RPG/d10_character_sheet node tests/test_tabs.mjs
else
echo 'Node.js is unavailable on this agent; skipping the JavaScript tab check.'
fi
'''
}
}
stage('Publish') {
steps {
archiveArtifacts artifacts: 'RPG/d10_character_sheet/**', fingerprint: true, onlyIfSuccessful: true
}
}
stage('Deploy') {
when {
branch 'master'
}
steps {
sh '''
set -eu
mkdir -p "$DEPLOY_DIR"
rsync -a --delete RPG/d10_character_sheet/ "$DEPLOY_DIR/"
test -f "$DEPLOY_DIR/assets/robotman_health_r.png"
test -f "$DEPLOY_DIR/assets/robotman_armor_r.png"
test -f "$DEPLOY_DIR/cyberpunk/sheet.html"
'''
}
}
}
}