From 161223fd7384f94c5755cd70db05782bc80a1fdf 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 | 25 ++++++++++++++++++------- .github/workflows/release.yml | 3 --- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh index 84edb81..0127e74 100644 --- a/.github/scripts/release.sh +++ b/.github/scripts/release.sh @@ -12,18 +12,29 @@ set -e set -o pipefail -# Check the number of arguments passed. -if [ "$#" -ne 3 ]; then - echo "Error: Invalid or insufficient arguments provided!" >&2 - echo "Usage: $0 " >&2 - exit 1 -fi - # Assign command line arguments to variables. 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 c8619c8..bb6e97d 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: