strapi/scripts/publish.sh

40 lines
874 B
Bash
Raw Normal View History

#!/bin/bash
2020-01-07 17:13:21 +01:00
# Force start from root folder
cd "$(dirname "$0")/.."
set -e
version=$VERSION
distTag=$DIST_TAG
2025-07-21 16:55:39 +03:00
preid=$PREID
2020-01-07 17:13:21 +01:00
if [[ -z "$version" ]]; then
echo "Please enter the version you want to publish"
read -r version
fi
if [[ -z "$distTag" ]]; then
echo "Please enter the dist-tag you want to publish with"
read -r distTag
fi
2020-01-07 17:13:21 +01:00
# Ensure GitHub token is available
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "Error: GITHUB_TOKEN environment variable is not set."
exit 1
fi
2025-07-21 16:55:39 +03:00
preid_arg=""
if [[ "$VERSION" == pre* && "$preid" != "latest" && -n "$preid" ]]; then
preid_arg="--preid $preid"
fi
# Configure Git
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
2020-01-07 17:13:21 +01:00
# publish packages
2025-07-21 16:55:39 +03:00
GITHUB_TOKEN=$GITHUB_TOKEN yarn release --version "$version" --tag "$distTag" --dry-run false $preid_arg "$@"