<commit_before>#!/bin/bash
set -eEuo pipefail

log() {
    echo "$(date -Iseconds) $*"
}

signkeypath="$PWD/sign-key.gpg"
s3bucket="${S3_BUCKET-dl-k6-io}"

if ! [ -r "$signkeypath" ]; then
  log "ERROR: Signing key not found at '$signkeypath'"
  exit 1
fi

gpg2 --import --batch --passphrase="$<PASSWORD>" "$signkeypath"
export PGPKEYID="$(gpg2 --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5)"
# TODO: Publish the pub key to S3

# Setup RPM signing
cat > "$HOME/.rpmmacros" <<EOF
%_gpgbin        $(which gpg2)
%_gpg_path      $HOME/.gnupg
%_gpg_name      k6
%_gpg_pass      -
%__gpg_sign_cmd   %{__gpg} gpg2 --default-key="$PGPKEYID" --no-verbose --no-armor --pinentry-mode=loopback --yes --passphrase="$<PASSWORD>" --no-secmem-warning --detach-sign -o %{__signature_filename} %{__plaintext_filename}
EOF

for repo in deb rpm msi; do
  log "Creating ${repo} repository ..."
  "create-${repo}-repo.sh" "$PWD/dist" "$PWD/dl.k6.io/${repo}"
done

log "Generating index.html ..."
(cd dl.k6.io && generate_index.py -r)

log "Syncing to S3 ..."
s3cmd sync ./dl.k6.io/ "s3://${s3bucket}/"

# Disable cache for repo metadata, so that new releases will be available
# immediately.
# TODO: Maybe do this inside each script?
# TODO: How to handle k6-latest-amd64.msi? Could it be an S3 redirect that is never cached?
s3cmd modify --add-header="Cache-Control:no-cache, max-age=0" \<commit_msg>Use Packages as main directory instead of dl.k6.io<commit_after>#!/bin/bash
set -eEuo pipefail

log() {
    echo "$(date -Iseconds) $*"
}

signkeypath="$PWD/sign-key.gpg"
s3bucket="${S3_BUCKET-dl-k6-io}"

if ! [ -r "$signkeypath" ]; then
  log "ERROR: Signing key not found at '$signkeypath'"
  exit 1
fi

gpg2 --import --batch --passphrase="$PGP_SIGN_KEY_PASSPHRASE" "$signkeypath"
export PGPKEYID="$(gpg2 --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5)"
# TODO: Publish the pub key to S3

# Setup RPM signing
cat > "$HOME/.rpmmacros" <<EOF
%_gpgbin        $(which gpg2)
%_gpg_path      $HOME/.gnupg
%_gpg_name      k6
%_gpg_pass      -
%__gpg_sign_cmd   %{__gpg} gpg2 --default-key="$PGPKEYID" --no-verbose --no-armor --pinentry-mode=loopback --yes --passphrase="$<PASSWORD>" --no-secmem-warning --detach-sign -o %{__signature_filename} %{__plaintext_filename}
EOF

for repo in deb rpm msi; do
  log "Creating ${repo} repository ..."
  "create-${repo}-repo.sh" "$PWD/dist" "$PWD/Packages/${repo}"
done

log "Generating index.html ..."
(cd Packages && generate_index.py -r)

log "Syncing to S3 ..."
s3cmd sync ./Packages/ "s3://${s3bucket}/"

# Disable cache for repo metadata, so that new releases will be available
# immediately.
# TODO: Maybe do this inside each script?
# TODO: How to handle k6-latest-amd64.msi? Could it be an S3 redirect that is never cached?
s3cmd modify --add-header="Cache-Control:no-cache, max-age=0" \
{'fraction_non_alphanumeric': 0.16983791402396053, 'fraction_numerical': 0.01620859760394644, 'mean_word_length': 3.6237785016286646, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, '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': '213182', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1080, 'n_words': 295}