<commit_before>#!/bin/bash
set -e

# This script should be run after the build/tests have successfully completed

MAJOR_MINOR=$1

DESCRIBE=`git describe --tags --always`
REV=$(git log --pretty=format:'%h' -n 1)

CURR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[1]}'`
echo "Got current git version $CURR_VERSION"
MAJOR_VERSION=`echo $CURR_VERSION | awk '{split($0,a,"."); print a[1]}'`
MINOR_VERSION=`echo $CURR_VERSION | awk '{split($0,a,"."); print a[2]}'`

if [ "$MAJOR_MINOR" == "Minor" ]; then
    ((MINOR_VERSION++))
elif [ "$MAJOR_MINOR" == "Major" ]; then
    ((MAJOR_VERSION++))
    ((MINOR_VERSION=0))
else
    echo "Error, unrecognized release type $MAJOR_MINOR.  Options are 'Major' and 'Minor'"
    exit 1
fi

echo "New version will be $MAJOR_VERSION.$MINOR_VERSION"

cd $WORKSPACE

git tag -a $MAJOR_VERSION.$MINOR_VERSION -m "New $MAJOR_MINOR release"

dch -v "$MAJOR_VERSION.$MINOR_VERSION-1" "Built from git. $REV"
dch -D unstable -r ""

dpkg-buildpackage -A -rfakeroot -us -uc

ARTIFACTS_DIR=$WORKSPACE/$BUILD_NUMBER-ARTIFACTS
mkdir $ARTIFACTS_DIR
mv $WORKSPACE/../jibri_$MAJOR_VERSION.$MINOR_VERSION* $ARTIFACTS_DIR

find $ARTIFACTS_DIR -name *.deb -exec gpg --batch --passphrase-file ~/.gnupg/passphrase -sba '{}' \;
ls -l $ARTIFACTS_DIR
mv $ARTIFACTS_DIR/jibri*{.deb,.changes} $REPO_DIR/mini-dinstall/incoming
mv $ARTIFACTS_DIR/jibri*.asc $REPO_DIR/unstable/signatures
ls -l $REPO_DIR/mini-dinstall/incoming

/var/lib/jenkins/bin/clean-oldies.sh unstable jibri

# call repo update script
mini-dinstall -b -c $MINID_CONF_FILE $REPO_DIR

# sync with download server
/var/lib/jenkins/bin/sync-repo.sh unstable

#TODO: push tag to remote<commit_msg>push new version tag to repo<commit_after>#!/bin/bash
set -e

# This script should be run after the build/tests have successfully completed

MAJOR_MINOR=$1

DESCRIBE=`git describe --tags --always`
REV=$(git log --pretty=format:'%h' -n 1)

CURR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[1]}'`
echo "Got current git version $CURR_VERSION"
MAJOR_VERSION=`echo $CURR_VERSION | awk '{split($0,a,"."); print a[1]}'`
MINOR_VERSION=`echo $CURR_VERSION | awk '{split($0,a,"."); print a[2]}'`

if [ "$MAJOR_MINOR" == "Minor" ]; then
    ((MINOR_VERSION++))
elif [ "$MAJOR_MINOR" == "Major" ]; then
    ((MAJOR_VERSION++))
    ((MINOR_VERSION=0))
else
    echo "Error, unrecognized release type $MAJOR_MINOR.  Options are 'Major' and 'Minor'"
    exit 1
fi

NEW_VERSION=$MAJOR_VERSION.$MINOR_VERSION
echo "New version will be $NEW_VERSION"

cd $WORKSPACE

git tag -a $NEW_VERSION -m "New $MAJOR_MINOR release"

dch -v "$NEW_VERSION-1" "Built from git. $REV"
dch -D unstable -r ""

dpkg-buildpackage -A -rfakeroot -us -uc

ARTIFACTS_DIR=$WORKSPACE/$BUILD_NUMBER-ARTIFACTS
mkdir $ARTIFACTS_DIR
mv $WORKSPACE/../jibri_$NEW_VERSION* $ARTIFACTS_DIR

find $ARTIFACTS_DIR -name *.deb -exec gpg --batch --passphrase-file ~/.gnupg/passphrase -sba '{}' \;
ls -l $ARTIFACTS_DIR
mv $ARTIFACTS_DIR/jibri*{.deb,.changes} $REPO_DIR/mini-dinstall/incoming
mv $ARTIFACTS_DIR/jibri*.asc $REPO_DIR/unstable/signatures
ls -l $REPO_DIR/mini-dinstall/incoming

/var/lib/jenkins/bin/clean-oldies.sh unstable jibri

# call repo update script
mini-dinstall -b -c $MINID_CONF_FILE $REPO_DIR

# sync with download server
/var/lib/jenkins/bin/sync-repo.sh unstable

git push origin $NEW_VERSION
{'fraction_non_alphanumeric': 0.1538231780167264, 'fraction_numerical': 0.006571087216248507, 'mean_word_length': 4.74442538593482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4200315', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1315, 'n_words': 318}