name: Release

on:
  workflow_dispatch:
    inputs:
      environment:
        description: Target environment
        required: true
        default: staging
        type: choice
        options: [staging, production]

permissions:
  contents: read

jobs:
  staging:
    uses: ./.github/workflows/reusable-build.yml
    with:
      environment: staging
      node-version: "20"

  production:
    needs: staging
    if: inputs.environment == 'production'
    uses: ./.github/workflows/reusable-build.yml
    with:
      environment: production

  announce:
    needs: [staging, production]
    runs-on: ubuntu-latest
    steps:
      - run: echo "built ${{ needs.staging.outputs.artifact-name }}"
