From 10f87b881d8a13f529f903f899b7e622dc0ebe26 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Fri, 18 Apr 2025 13:36:13 +0530 Subject: [PATCH] Configure the release to be triggered on workflow dispatch only --- .github/scripts/release.sh | 18 ++++++++++++++++++ .github/workflows/release.yml | 3 --- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh index 57d2823..ebffc94 100644 --- a/.github/scripts/release.sh +++ b/.github/scripts/release.sh @@ -25,6 +25,24 @@ GIT_TOKEN=$1 WORK_DIR=$2 VERSION_TYPE=$3 # possible values: major, minor, patch + Check if GIT_TOKEN is empty +if [ -z "$GIT_TOKEN" ]; then + echo "❌ Error: GIT_TOKEN is not set." + exit 1 +fi + +# Check if WORK_DIR is empty +if [ -z "$WORK_DIR" ]; then + echo "❌ Error: WORK_DIR is not set." + exit 1 +fi + +# Validate VERSION_TYPE +if [[ "$VERSION_TYPE" != "major" && "$VERSION_TYPE" != "minor" && "$VERSION_TYPE" != "patch" ]]; then + echo "❌ Error: VERSION_TYPE must be one of: major, minor, or patch." + exit 1 +fi + BUILD_DIRECTORY="$WORK_DIR/build" RELEASE_DIRECTORY="$BUILD_DIRECTORY/releases" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63e56b6..e55f6b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,9 +10,6 @@ name: Release on: - pull_request: - branches: [ main ] - types: [closed] workflow_dispatch: inputs: version_type: