<commit_before>#!/usr/bin/env bash

set -e

# create a random passphrase
export GPG_PASSPHRASE=$(echo "$RANDOM$(date)" | md5sum | cut -d\  -f1)

# configuration to generate gpg keys
cat >gen-key-script <<EOF
    %echo Generating a basic OpenPGP key
    Key-Type: RSA
    Key-Length: 4096
    Name-Real: CurrencyFair
    Name-Email: <EMAIL>
    Expire-Date: 0y
    Passphrase: ${GPG_PASSPHRASE}
    %commit
    %echo done
EOF

# create a local keypair with given configuration
gpg --batch --gen-key gen-key-script


# export created GPG key
#
# example output
# sec   4096R/EDD32E8B 2016-09-08 [verfällt: 2018-09-08]
# uid                  <NAME> <<EMAIL>>
# ssb   4096R/CC1613B2 2016-09-08
# ssb   4096R/55B7CAA2 2016-09-08
export GPG_KEYNAME=$(gpg -K | grep ^\\s | head -n1)

# cleanup local configuration
shred gen-key-script

# publish the gpg key
# (use keyserver.ubuntu.com as travis request keys from this server,
#  we avoid synchronization issues, while releasing)
gpg --keyserver keyserver.ubuntu.com --send-keys ${GPG_KEYNAME}

# check that the key is accessible
mkdir -m 700 ./gpgtest
while(true); do<commit_msg>more logging, changed expiration date<commit_after>#!/usr/bin/env bash

set -e

# create a random passphrase
export GPG_PASSPHRASE=$(echo "$RANDOM$(date)" | md5sum | cut -d\  -f1)

# configuration to generate gpg keys
cat >gen-key-script <<EOF
    %echo Generating a basic OpenPGP key
    Key-Type: RSA
    Key-Length: 4096
    Name-Real: CurrencyFair
    Name-Email: <EMAIL>
    Expire-Date: 1d
    Passphrase: ${GPG_PASSPHRASE}
    %commit
    %echo done
EOF

# create a local keypair with given configuration
gpg --batch --gen-key gen-key-script


# export created GPG key
#
# example output
# sec   4096R/EDD32E8B 2016-09-08 [verfällt: 2018-09-08]
# uid                  <NAME> <<EMAIL>>
# ssb   4096R/CC1613B2 2016-09-08
# ssb   4096R/55B7CAA2 2016-09-08
gpg -K
export GPG_KEYNAME=$(gpg -K | grep ^sec | cut -d/  -f2 | cut -d\  -f1 | head -n1)

# cleanup local configuration
shred gen-key-script

# publish the gpg key
# (use keyserver.ubuntu.com as travis request keys from this server,
#  we avoid synchronization issues, while releasing)
echo "Uploading key ${GPG_KEYNAME} to keyserver.ubuntu.com"
gpg --keyserver keyserver.ubuntu.com --send-keys ${GPG_KEYNAME}

# check that the key is accessible
mkdir -m 700 ./gpgtest
echo "Checking key ${GPG_KEYNAME} is on keyserver.ubuntu.com"
while(true); do
{'fraction_non_alphanumeric': 0.11198023878139152, 'fraction_numerical': 0.05599011939069576, 'mean_word_length': 3.3161634103019537, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '710465', 'n_tokens_mistral': 988, 'n_tokens_neox': 878, 'n_words': 272}