Compare commits

..

No commits in common. "0df22454a39a5c42c9b38244dfb04ed05a0e5777" and "8ee2abdbd7a2c17118a6cbb34297110427e9833b" have entirely different histories.

View File

@ -7,6 +7,12 @@ on:
- test # → PATCH bump, build & tag as test - test # → PATCH bump, build & tag as test
- main # → MINOR bump, promote test→prod - main # → MINOR bump, promote test→prod
workflow_dispatch: workflow_dispatch:
inputs:
environment:
description: 'Target environment: "test" (PATCH bump) or "prod" (MINOR bump). Invalid values fail early with validation error.'
required: true
default: 'test'
type: string
jobs: jobs:
version: version:
@ -22,9 +28,15 @@ jobs:
- name: Determine environment - name: Determine environment
id: env id: env
run: | run: |
[[ "${{ github.ref_name }}" == "main" ]] && ENV="prod" || ENV="${{ github.ref_name }}" if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
ENV="${{ inputs.environment }}"
else
# Push events: test branch → test env, main branch → prod env
[[ "${{ github.ref_name }}" == "main" ]] && ENV="prod" || ENV="${{ github.ref_name }}"
fi
# Validate
if [[ "$ENV" != "test" && "$ENV" != "prod" ]]; then if [[ "$ENV" != "test" && "$ENV" != "prod" ]]; then
echo "✦ Invalid environment: $ENV. Must be 'test' or 'prod'." echo " Invalid environment: $ENV. Must be 'test' or 'prod'."
exit 1 exit 1
fi fi
echo "target_env=$ENV" >> $GITHUB_OUTPUT echo "target_env=$ENV" >> $GITHUB_OUTPUT