Unverified Commit 58d82e76 authored by Truc Nguyen's avatar Truc Nguyen Committed by GitHub
Browse files

feat(build): add Jenkinsfile (#13)

parent a10a97f1
#!/usr/bin/env groovy
boolean isVersionSupported(version, supportedVersions) {
def result = false
for (supported in supportedVersions.tokenize(',')) {
if (supported == version) {
result = true
def status = result ? 'supported' : 'NOT supported'
println "Version <$version> is $status on this environment."
return result
node {
stage 'Checkout'
def branch_name = env.BRANCH_NAME
println "Checking out branch $branch_name"
checkout scm
stage 'Build'
def nodejsHome = tool name: 'NodeJS_424', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
sh """#!/bin/bash
set -e
env | sort -u
echo "### Cleaning previous build (except index.html)"
shopt -s extglob
rm -rf build
echo ""
echo "### Converting .md to .html"
npm install
scripts/convertMdToHtml.js bcd
echo ""
echo "### Creating doc html archive"
archive_name=doc-bcd-html-\$BRANCH_NAME-`date +"%Y%m%d_%H%M%S"`.tar.gz
rm -rf doc-bcd-html*.tar.gz doc-bcd-html
mkdir doc-bcd-html && ln -s ../build/html doc-bcd-html/html && ln -s ../md/images doc-bcd-html/images
tar czf \$archive_name --dereference doc-bcd-html
echo ". Generated archive: \$archive_name"
echo ""
echo "Done."
stage 'Archive'
archive '**/doc-bcd-html*.tar.gz'
stage 'Deploy'
parallel preprod: {
if (isVersionSupported(branch_name, env.GLOBAL_PREPROD_BCD_VERSIONS)) {
build job: 'push-content-preprod', parameters: [[$class: 'StringParameterValue', name: 'ARE_YOU_SURE', value: 'Yes']]
}, prod: {
if (isVersionSupported(branch_name, env.GLOBAL_PROD_BCD_VERSIONS)) {
build job: 'push-content-prod', parameters: [[$class: 'StringParameterValue', name: 'ARE_YOU_SURE', value: 'Yes']]
failFast: false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment