<commit_before>#!/bin/bash

#
# EXPECTING THE FOLLOWING GLOBAL VARS
#  - GITHUB_AUTH_TOKEN = string
#  - GITHUB_AUTH_USER = string
#  - GWBT_TAG = string from https://github.com/codeclou/jenkins-github-webhook-build-trigger-plugin
#             if set release publish will execute. If empty, release publish will not execute.
#  - GWBT_COMMIT_AFTER = string from https://github.com/codeclou/jenkins-github-webhook-build-trigger-plugin

set -e

mkdir build-results
chmod 777 build-results

#
# ONLY MASTER
#
if [[ "${GWBT_BRANCH}" != "documentation" ]]
then
	echo "Only build documentation branch!"
  exit 0
fi

#
# BUILD SCRIPT - RUNS INSIDE DOCKER
#
cat <<EOF > jenkins--inside-docker.sh
#!/bin/bash
set -e
cp -r /work /work-private
cd /work-private
npm -version
npm config set registry http://nopar.codeclou.io/
npm install -g node-deploy-essentials
npm install -g @angular/cli
npm install
sed -i "s/___COMMIT___/$GWBT_COMMIT_AFTER/" ./src/app/app.component.ts
ng build -prod
cd /work-private/dist
ls -lah
# Create zip without .git but with e.g. .htaccess
if [ -d ".git" ]; then rm -rf .git; fi
# add '.htaccess' manually
zip -r deploy.zip *
cp deploy.zip /work/build-results/
chmod 777 /work/build-results/deploy.zip
ls -lah
echo "Deploying to to https://cloukit.github.io/"
npm run ndes deployToGitHubPages \
    as "codeclou-ci" \
    withEmail "<EMAIL>" \
    withGitHubAuthUsername $GITHUB_AUTH_USER \
    withGitHubAuthToken $GITHUB_AUTH_TOKEN \
    toRepository https://github.com/cloukit/cloukit.github.io.git \<commit_msg>final build<commit_after>#!/bin/bash

#
# EXPECTING THE FOLLOWING GLOBAL VARS
#  - GITHUB_AUTH_TOKEN = string
#  - GITHUB_AUTH_USER = string
#  - GWBT_TAG = string from https://github.com/codeclou/jenkins-github-webhook-build-trigger-plugin
#             if set release publish will execute. If empty, release publish will not execute.
#  - GWBT_COMMIT_AFTER = string from https://github.com/codeclou/jenkins-github-webhook-build-trigger-plugin

set -e

mkdir build-results
chmod 777 build-results

#
# ONLY MASTER
#
if [[ "${GWBT_BRANCH}" != "documentation" ]]
then
	echo "Only build documentation branch!"
  exit 0
fi

#
# BUILD SCRIPT - RUNS INSIDE DOCKER
#
cat <<EOF > jenkins--inside-docker.sh
#!/bin/bash
set -e
cp -r /work /work-private
cd /work-private
npm -version
npm config set prefix '/work /work-private/npm-global'
npm config set registry http://nopar.codeclou.io/
npm install -g node-deploy-essentials
npm install -g @angular/cli
npm install
sed -i "s/___COMMIT___/$GWBT_COMMIT_AFTER/" ./src/app/app.component.ts
ng build -prod
cd /work-private/dist
ls -lah
# Create zip without .git but with e.g. .htaccess
if [ -d ".git" ]; then rm -rf .git; fi
# add '.htaccess' manually
zip -r deploy.zip *
cp deploy.zip /work/build-results/
chmod 777 /work/build-results/deploy.zip
ls -lah
echo "Deploying to to https://cloukit.github.io/"
npm run ndes deployToGitHubPages \
    as "codeclou-ci" \
    withEmail "<EMAIL>" \
    withGitHubAuthUsername $GITHUB_AUTH_USER \
    withGitHubAuthToken $GITHUB_AUTH_TOKEN \
    toRepository https://github.com/cloukit/cloukit.github.io.git \
{'fraction_non_alphanumeric': 0.12215453671048412, 'fraction_numerical': 0.004488618146841937, 'mean_word_length': 3.5151953690303905, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '441494', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1108, 'n_words': 299}