What I can not see in your workflow is that you also set the environment name. I set the environment name via an input.
Here is an example.
name: Build and Deploy
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Choose environment
options:
- stage
- production
jobs:
deploy:
environment: ${{inputs.environment}}
runs-on: ubuntu-latest
steps:
# ..