From Commit to Release: Automating GitHub Workflows
This documentation describes an automated GitHub workflow system that handles pull request labelling and automated releases for both development and production environments. The system uses branch naming conventions to automatically label PRs, generates release notes, and manages versioning.
How It Works
PR Labeling System
- Monitors for new pull requests
- Analyses branch names to apply appropriate labels
- Uses configured patterns in
pr-labeler.yml - Labels determine how changes are categorised in releases
Release Management
- Development Releases
- Triggered by pushes to
devbranch - Creates draft releases
- Maintains development version tracking
- Triggered by pushes to
- Production Releases:
- Triggered by pushes to
mainbranch - Automatically publishes releases
- Includes hotfix detection
- Triggered by pushes to
- Version Resolution : Automatically determines version numbers based on PR labels
breaking→ Major version bumpfeature,fix→ Minor version bumpchore, etc. → Patch version bump
Setup Instructions
Prerequisites
- GitHub Personal Access Token (classic) or Organisation Token
- Token Must have private repository read, write and workflow permissions
Required Files Structure
📦root
┣📦.github
┣ 📂workflows
┃ ┣ 📜pr-labeler.yml # PR labeling workflow
┃ ┣ 📜release-dev.yml # Development release workflow
┃ ┗ 📜release-prod.yml # Production release workflow
┣ 📜pr-labeler.yml # Label configuration
┗ 📜release-drafter.yml # Release configuration
Customising Templates
Modifying PR Labels
To add or modify label patterns, edit .github/pr-labeler.yml:
# Add new label
enhancement: ["enhance/*", "improvement/*"]
# Modify existing label
feature:
- "feature/*"
- "feat/*"
- "new/*"
Customising Release Notes
Edit .github/release-drafter.yml:
- Change Categories:
categories:
- title: '🚀 New Features' # Modified emoji and title
labels:
- 'feature'
- 'enhancement'
- title: '🔧 Improvements' # New category
labels:
- 'improvement'
- Modify Change Format:
# Add commit details
change-template: '- $TITLE (#$NUMBER)\n $COMMIT_MESSAGES'
- Custom Release Template:
template: |
## Release v$RESOLVED_VERSION
### What's Changed
$CHANGES
### Contributors
$CONTRIBUTORS
### Additional Notes
_Released on: $RELEASE_DATE_
Branch Naming Convention
<type>/<description>
Types:
feature/ → New features (minor version)
fix/ → Bug fixes (minor version)
chore/ → Maintenance (patch version)
breaking/ → Breaking changes (major version)
Examples:
feature/user-authentication
fix/login-timeout
chore/update-dependencies
breaking/api-v2
Development Flow
- Create Feature Branch:
git checkout -b feature/new-login
- Make Changes and Commit:
git commit -m "feat: Add OAuth login"
git commit -m "Add password reset"
- Create Pull Request:
- Title: "Add new authentication system"
- Branch will automatically be labeled as "feature"
- Merge Process:
- Dev: Creates draft release
- Main: Publishes release automatically
Troubleshooting
Common Issues
- PR Labels Not Applied
- Verify branch name matches patterns in
pr-labeler.yml - Check workflow permissions in GitHub
- Verify TOKEN secret is configured
- Release Not Generated
- Check branch matches workflow trigger (
devormain) - Review workflow run logs for errors
.githubdir with all files needs to be in both (devandmain)
- Incorrect Version Numbers
- Check PR labels match
version-resolverconfiguration - Verify label application in PR
- Review version resolution rules
Support & Future Improvements
- Review GitHub Actions logs
- https://help.shortcut.com/hc/en-us/articles/207540323-Using-Branches-and-Pull-Requests-with-the-Shortcut-VCS-Integrations
Thank You
Continue Reading
How to Handle Browser Back Button Navigation Events in Vue 3
As web applications become more sophisticated, managing browser navigation becomes increasingly complex. One common challenge is handling the browser's back button when dealing with modals, dialogs, or drawers. Today, we'll explore a powerful Vue 3 composable that solves this problem while maintaining a smooth user experience.
Nuxt Server-Side Proxy for Open Weather Api
A common problem when using open weather api is Cross-Origin Resource Sharing (CORS) issues. This typically happens when you're trying to make an API call from a web application running in a browser, and the browser blocks the request because the API server does not include the necessary CORS headers in its response. The quickest fix is to add a cors header however, as we do not control the api server we can not add a cors header even if we wanted too.