GitHub Environments Setup¶
uptool uses GitHub Environments with approval gates to control releases. This provides an additional layer of security and creates an audit trail for all releases.
Overview¶
Three environments are configured in the release workflows:
- pre-release - Used for creating pre-release versions (rc/beta/alpha)
- production - Used for promoting pre-releases to stable versions
- patch-release - Used for creating patch releases on release branches
All environments require manual approval from designated reviewers before the workflow can proceed with creating/promoting releases.
Environment Configuration¶
Prerequisites¶
- Repository administrator access
- Appropriate repository permissions (Settings → Environments)
Creating Environments¶
1. Navigate to Environments¶
- Go to your repository on GitHub
- Click Settings (top menu)
- In the left sidebar, click Environments
2. Create Pre-Release Environment¶
- Click New environment
- Name:
pre-release - Click Configure environment
Configure the following protection rules:
- ✅ Required reviewers
- Add maintainers who should approve pre-releases
- Recommended: At least 1 reviewer
-
Prevents accidental pre-release creation
-
✅ Wait timer (optional)
- Set to 0 minutes (no automatic delay)
-
Or add a delay if desired
-
✅ Deployment branches and tags
- Select: Selected branches and tags
- Add rule:
mainbranch only - This ensures only main branch can create releases
Environment secrets (if needed):
- No additional secrets required for basic setup
- GitHub token is automatically provided
Save the environment
3. Create Production Environment¶
- Click New environment
- Name:
production - Click Configure environment
Configure the following protection rules:
- ✅ Required reviewers
- Add maintainers who should approve stable releases
- Recommended: At least 2 reviewers for production
-
Requires multiple approvals for critical releases
-
✅ Wait timer (optional)
- Set to 0 minutes for immediate review
-
Or set to 10-30 minutes for time to review changes
-
✅ Deployment branches and tags
- Select: Selected branches and tags
- Add rule:
mainbranch only -
Ensures only main branch can promote to stable
-
⚠️ Prevent self-review (recommended)
- Enable this to require approval from someone other than the workflow trigger
Environment secrets (if needed):
- No additional secrets required for basic setup
Save the environment
4. Create Patch Release Environment¶
- Click New environment
- Name:
patch-release - Click Configure environment
Configure the following protection rules:
- ✅ Required reviewers
- Add maintainers who should approve patch releases
- Recommended: At least 1 reviewer (can be same as pre-release)
-
Ensures security/bug fixes are reviewed before release
-
✅ Wait timer (optional)
- Set to 0 minutes for immediate review
-
Patch releases are typically urgent (security fixes)
-
✅ Deployment branches and tags
- Select: Selected branches and tags
- Add pattern:
release-*(for release branches) -
This ensures only release branches can create patch releases
-
⚠️ Prevent self-review (recommended)
- Enable this for security patches especially
Environment secrets (if needed):
- No additional secrets required for basic setup
Save the environment
Approval Workflow¶
Pre-Release Creation¶
When someone triggers the Pre-Release workflow:
- Workflow calculates version and updates files
- Tests run automatically
- Workflow pauses at the
buildjob - GitHub sends notification to required reviewers
- Reviewer(s) must approve or reject the deployment
- If approved: artifacts are built and pre-release is created
- If rejected: workflow is cancelled
Approval screen shows:
- Pre-release version (e.g.,
v0.2.0-rc1) - Commit SHA being released
- Link to the release page (once approved)
- Comment field for approval notes
Stable Release Promotion¶
When someone triggers the Promote to Stable Release workflow:
- Workflow validates pre-release tag exists
- Updates version files to stable
- Tests run automatically
- Workflow pauses at the
promotejob - GitHub sends notification to required reviewers
- Reviewer(s) must approve or reject the deployment
- If approved: artifacts are promoted and stable release is created
- If rejected: workflow is cancelled
Approval screen shows:
- Pre-release being promoted (e.g.,
v0.2.0-rc1) - Stable version (e.g.,
v0.2.0) - Link to the stable release page (once approved)
Patch Release Creation¶
When someone triggers the Patch Release workflow:
- Workflow validates release branch exists
- Updates version files on release branch
- Builds binaries and generates SBOMs
- Workflow pauses at the
releasejob - GitHub sends notification to required reviewers
- Reviewer(s) must approve or reject the deployment
- If approved: artifacts are signed and patch release is created
- If rejected: workflow is cancelled
Approval screen shows:
- Release branch (e.g.,
release-0.1) - Patch version (e.g.,
v0.1.1) - Patch type (security or bugfix)
- Commits included in patch
- Link to the patch release page (once approved)
Approving a Deployment¶
As a Reviewer¶
When you receive a deployment approval request:
- Check your email or GitHub notifications
- Go to Actions tab in the repository
- Find the workflow run waiting for approval
- Review the details:
- Check the version being released
- Review the commits included
- Verify tests passed
-
Check CHANGELOG updates
-
Click Review deployments
- Select the environment (
pre-release,production, orpatch-release) - Add a comment (optional but recommended):
- Click Approve and deploy or Reject
Review Checklist¶
Before approving a pre-release:
- Version number is correct
- All tests passed
- No breaking changes without documentation
- CHANGELOG is updated
- Commit messages follow conventional commits
Before approving a stable release:
- Pre-release was tested successfully
- No critical issues reported
- Documentation is accurate
- Version matches what was tested
- All artifacts are present
Before approving a patch release:
- Patch is on correct release branch (e.g.,
release-0.1) - Version increment is correct (patch only)
- Security vulnerability is properly fixed (if security patch)
- Changes are minimal and targeted (no feature additions)
- All tests passed on release branch
- No conflicts with existing stable releases
Viewing Deployment History¶
GitHub tracks all deployments in the environment:
- Go to Settings → Environments
- Click on
pre-release,production, orpatch-release - View Deployment history:
- Who triggered the workflow
- Who approved/rejected
- When it was deployed
- Links to workflow runs
- Comments from reviewers
This creates a complete audit trail for compliance.
Bypassing Approval (Not Recommended)¶
Warning: Only repository administrators can bypass environment protection rules.
If you need to bypass approval (emergency only):
- Go to Settings → Environments
- Select the environment
- Temporarily remove Required reviewers
- Run the workflow
- Immediately re-enable required reviewers
Better approach: Add yourself as an approved reviewer if needed.
Troubleshooting¶
Workflow stuck waiting: Check Actions tab for "Review deployments" button, verify you're a required reviewer
Cannot approve: Ensure you're listed as reviewer and didn't trigger the workflow yourself (if self-review prevented)
Environment not found: Verify environment names in workflow files match Settings → Environments exactly
Security Best Practices¶
Required Reviewers¶
Pre-release environment:
- Minimum: 1 reviewer
- Recommended: 1-2 reviewers
- Should include: Project maintainers
Production environment:
- Minimum: 2 reviewers
- Recommended: 2-3 reviewers
- Should include: Senior maintainers, security lead
Patch release environment:
- Minimum: 1 reviewer
- Recommended: 1-2 reviewers (can be same as pre-release)
- Should include: Security lead (for security patches), maintainers
- Note: Security patches should be expedited but still reviewed
Branch Protection¶
Combine environment protection with branch protection:
- Go to Settings → Branches
- Add rule for
mainbranch: - ✅ Require pull request reviews (at least 1)
- ✅ Require status checks to pass
- ✅ Require branches to be up to date
-
✅ Include administrators
-
Add rule for
release-*pattern (for patch release branches): - ✅ Require pull request reviews (at least 1)
- ✅ Require status checks to pass
- ✅ Include administrators
- ✅ Restrict who can push (maintainers only)
This ensures:
- Code is reviewed before merging
- Tests pass before merging
- Releases require additional approval
- Patch releases are protected and audited
Audit Trail¶
GitHub automatically logs:
- Who triggered the workflow
- Who approved/rejected
- When deployment occurred
- Environment variables used
- Workflow run details
Export deployment logs regularly for compliance:
- Go to Settings → Environments → [Environment]
- View deployment history
- Document approvals in release notes
Example Release Flow¶
Standard Release Flow¶
- Pre-Release: Trigger workflow → Reviewer approves →
v0.2.0-rc1created - Testing: Test artifacts, fix issues, create new RC if needed
- Promotion: Trigger promote workflow → Multiple reviewers approve →
v0.2.0created - Audit: All approvals logged in environment history
Patch Release Flow¶
- Security Fix: Vulnerability discovered in
v0.1.0 - Create Branch: Create
release-0.1fromv0.1.0tag (if not exists) - Apply Fix: Cherry-pick security fix to release branch
- Patch Release: Trigger patch workflow → Reviewer approves →
v0.1.1created - Audit: Patch release approval logged in patch-release environment history