Staging and production each have their own token: ~/staging-token.txt and ~/production-token.txt. Both deploy steps read DEPLOY_TOKEN. An environment keeps the two apart: a job that names one gets that environment's secrets, which win over the repository's.
staging:
environment: staging
runs-on: ubuntu-latestEnvironments can also hold rules, like "someone must approve deploys to production". The repository has a staging and a production environment, and the Deploy workflow names them. Set the secret for each with --env:
gh secret set DEPLOY_TOKEN --env staging < ~/staging-token.txtgh secret list --env staging lists one environment's secrets.
Objectives
- Give staging its token.
- Give production its token.