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

if [[ "$GITHUB_RELEASE_ACCESS_TOKEN" == "" ]]; then
  echo "Error: Missing \$GITHUB_RELEASE_ACCESS_TOKEN"
  exit 1
fi

echo '--- Downloading binaries'

rm -rf pkg
mkdir -p pkg
buildbox-agent build-artifact download "pkg/*" .

function build() {
  echo "--- Building release for: $1"

  ./scripts/utils/build-github-release.sh $1
}

# Export the function so we can use it in xargs
export -f build

# Make sure the releases directory is empty
rm -rf releases

# Loop over all the .deb files and build them
ls pkg/* | xargs -I {} bash -c "build {}"

echo '--- Getting agent version from build meta data'

AGENT_VERSION=$(buildbox-agent build-data get "agent-version" | sed 's/buildkite-agent version //')

echo "--- 🚀 $AGENT_VERSION"

if [[ "$AGENT_VERSION" == *"beta"* || "$AGENT_VERSION" == *"alpha"* ]]; then
  export GITHUB_RELEASE_PRERELEASE="true"
fi

export GITHUB_RELEASE_REPOSITORY="buildkite/agent"

github-release "v$AGENT_VERSION" releases/*<commit_msg>More fixes to the github release script.<commit_after>#!/bin/bash
set -e

if [[ "$GITHUB_RELEASE_ACCESS_TOKEN" == "" ]]; then
  echo "Error: Missing \$GITHUB_RELEASE_ACCESS_TOKEN"
  exit 1
fi

echo '--- Downloading binaries'

rm -rf pkg
mkdir -p pkg
# buildbox-agent build-artifact download "pkg/*" .

function build() {
  echo "--- Building release for: $1"

  ./scripts/utils/build-github-release.sh $1
}

# Export the function so we can use it in xargs
export -f build

# Make sure the releases directory is empty
rm -rf releases

# Loop over all the .deb files and build them
ls pkg/* | xargs -I {} bash -c "build {}"

echo '--- Getting agent version from build meta data'

AGENT_VERSION=$(buildbox-agent build-data get "agent-version" | sed 's/buildkite-agent version //')

echo "Version is $AGENT_VERSION"

echo "--- 🚀 $AGENT_VERSION"

export GITHUB_RELEASE_REPOSITORY="buildkite/agent"

if [[ "$AGENT_VERSION" == *"beta"* || "$AGENT_VERSION" == *"alpha"* ]]; then
  # Beta versions of the agent will have the build number at the end of them
  # like this:
  #
  #    buildkite-agent version 1.0-beta.7.227
  #
  # We don't want the build numbers for GitHub releases, so this command will
  # drop them.
  AGENT_VERSION=$($AGENT_VERSION | sed -E 's/\.[0-9]+$//')

  github-release "v$AGENT_VERSION" releases/* --prerelease
else
  github-release "v$AGENT_VERSION" releases/*
fi
{'fraction_non_alphanumeric': 0.13745271122320302, 'fraction_numerical': 0.0058848255569567045, 'mean_word_length': 3.7791164658634537, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6168919', 'n_tokens_mistral': 848, 'n_tokens_neox': 802, 'n_words': 263}