diff --git a/.gitea/workflows/pipeline-test.yaml b/.gitea/workflows/pipeline-test.yaml index 6ed094d..830a9b6 100644 --- a/.gitea/workflows/pipeline-test.yaml +++ b/.gitea/workflows/pipeline-test.yaml @@ -13,9 +13,25 @@ jobs: - name: Set Environment id: set-env run: | - echo "ENV=$(cat deploy_env.json | jq -r '.env')" >> $GITHUB_ENV - echo "::set-output name=environment::$ENV" - + # Ensure the deploy_env.json file exists and is readable + if [ ! -f deploy_env.json ]; then + echo "deploy_env.json does not exist or cannot be read." + exit 1 + fi + + # Extract the environment variable using jq and check if it's empty + ENV=$(cat deploy_env.json | jq -r '.env') + if [ -z "$ENV" ]; then + echo "Environment variable is empty." + exit 1 + fi + + # Use GitHub's environment file syntax to set the ENV variable + echo "ENV=$ENV" >> $GITHUB_ENV + + # Output the environment variable for use in subsequent steps + echo "::set-output name=environment::$ENV" + - name: Set up Go uses: actions/setup-go@v5.0.0 with: