Compare commits
No commits in common. "0df22454a39a5c42c9b38244dfb04ed05a0e5777" and "8ee2abdbd7a2c17118a6cbb34297110427e9833b" have entirely different histories.
0df22454a3
...
8ee2abdbd7
@ -7,6 +7,12 @@ on:
|
||||
- test # → PATCH bump, build & tag as test
|
||||
- main # → MINOR bump, promote test→prod
|
||||
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:
|
||||
version:
|
||||
@ -22,9 +28,15 @@ jobs:
|
||||
- name: Determine environment
|
||||
id: env
|
||||
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
|
||||
echo "✦ Invalid environment: $ENV. Must be 'test' or 'prod'."
|
||||
echo "❌ Invalid environment: $ENV. Must be 'test' or 'prod'."
|
||||
exit 1
|
||||
fi
|
||||
echo "target_env=$ENV" >> $GITHUB_OUTPUT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user