Reusable workflow for semantic versioning and automated release management. Creates releases based on conventional commits and manages version tags with GPG signing.
- Semantic versioning: Automatic version calculation from conventional commits
- GPG signing: Signed commits and tags for security
- GitHub App authentication: Higher rate limits and better security
- Hotfix support: Separate configuration for hotfix branches
- Backmerge support: Automatic backmerging of releases (falls back to creating a PR if the direct push fails due to branch divergence)
- Conventional commits: Enforces commit message standards
name: Release Pipeline
on:
push:
branches:
- develop
- release-candidate
- main
jobs:
release:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/release.yml@v1.0.0
secrets: inheritRequired Secrets:
LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID,LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY,LERIAN_CI_CD_USER_GPG_KEY,LERIAN_CI_CD_USER_GPG_KEY_PASSWORD,LERIAN_CI_CD_USER_NAME,LERIAN_CI_CD_USER_EMAIL
release:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/release.yml@v1.0.0
with:
runner_type: "blacksmith-4vcpu-ubuntu-2404"
semantic_version: "23.0.8"
secrets: inheritname: Release Pipeline
on:
push:
branches:
- develop
- release-candidate
- main
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.env'
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: make test
release:
needs: tests
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/release.yml@v1.0.0
secrets: inherit| Input | Type | Default | Description |
|---|---|---|---|
semantic_version |
string | 23.0.8 |
Semantic release version to use |
runner_type |
string | firmino-lxc-runners |
GitHub runner type |
| Secret | Description |
|---|---|
lerian_studio_push_bot_app_id |
GitHub App ID for authentication |
lerian_studio_push_bot_private_key |
GitHub App private key |
lerian_ci_cd_user_gpg_key |
GPG private key for signing commits |
lerian_ci_cd_user_gpg_key_password |
GPG key passphrase |
lerian_ci_cd_user_name |
Git committer name |
lerian_ci_cd_user_email |
Git committer email |
| Output | Description |
|---|---|
gpg_fingerprint |
GPG key fingerprint used for signing |
Commits to develop branch create beta releases:
- Version:
v1.2.3-beta.1 - Pre-release: Yes
- Use case: Development testing
Commits to release-candidate branch create RC releases:
- Version:
v1.2.3-rc.1 - Pre-release: Yes
- Use case: Staging/UAT testing
Commits to main branch create production releases:
- Version:
v1.2.3 - Pre-release: No
- Use case: Production deployment
The workflow uses .releaserc.yml for all branches (no separate hotfix configuration).
Configuration file: .releaserc.yml in repository root
The workflow uses conventional commits to determine version bumps:
feat!: remove deprecated API endpoint
BREAKING CHANGE: The /api/v1/old endpoint has been removed
Version: 1.0.0 → 2.0.0
feat: add user authentication
Version: 1.0.0 → 1.1.0
fix: resolve memory leak in transaction processor
Version: 1.0.0 → 1.0.1
docs: update API documentation
chore: update dependencies
style: fix code formatting
refactor: simplify authentication logic
perf: optimize database queries
test: add unit tests for auth module
ci: update GitHub Actions workflow
No version bump, but included in changelog.
Single configuration file for all branches:
branches:
- name: main
- name: release-candidate
prerelease: rc
- name: develop
prerelease: beta
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
releaseRules:
- type: feat
release: minor
- type: fix
release: patch
- type: perf
release: patch
- breaking: true
release: major
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- "@semantic-release/github"
- - "@saithodev/semantic-release-backmerge"
- backmergeBranches: [develop]
backmergeStrategy: merge- Create GitHub App Token: Generate authentication token with higher rate limits
- Checkout Repository: Clone with full history for versioning
- Sync with Remote: Ensure latest changes are pulled
- Import GPG Key: Import and configure GPG key for signing
- Initialize package.json: Create if doesn't exist
- Install Plugins: Install semantic-release plugins
- Run Semantic Release: Calculate version and create release using
.releaserc.yml
- Authenticity: Verify commits are from authorized sources
- Integrity: Ensure commits haven't been tampered with
- Compliance: Meet security requirements for production releases
- Generate GPG key:
gpg --full-generate-key- Export private key:
gpg --armor --export-secret-keys YOUR_EMAIL > private-key.asc- Add to GitHub Secrets:
GPG_PRIVATE_KEY: Contents ofprivate-key.ascGPG_KEY_PASSWORD: Key passphrase
- Add public key to GitHub:
gpg --armor --export YOUR_EMAILAdd to GitHub Settings → SSH and GPG keys
- Higher rate limits: 5,000 requests/hour vs 1,000 for PAT
- Better security: Scoped permissions, automatic token expiration
- Audit trail: Better tracking of automated actions
- Go to GitHub Settings → Developer settings → GitHub Apps
- Click "New GitHub App"
- Configure:
- Name:
My CI/CD Bot - Homepage URL: Your organization URL
- Permissions:
- Contents: Read & Write
- Pull Requests: Read & Write
- Metadata: Read-only
- Name:
- Generate private key
- Install app to repositories
- Add to secrets:
GITHUB_APP_ID: App IDGITHUB_APP_PRIVATE_KEY: Private key contents
Enforce with commitlint:
# .commitlintrc.yml
extends:
- '@commitlint/config-conventional'
rules:
type-enum:
- 2
- always
- [feat, fix, docs, style, refactor, perf, test, chore, revert, ci, build]Configure branch protection:
- Require pull request reviews
- Require status checks to pass
- Require signed commits
- Include administrators
jobs:
release:
environment:
name: productionAdd required reviewers for production releases.
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.env'jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Run tests
run: make test
release:
needs: testsIssue: Workflow runs but no release is created
Solutions:
- Check commit messages follow conventional commits
- Verify branch is configured in
.releaserc - Check if version already exists
- Review semantic-release logs
Issue: Cannot sign commits with GPG key
Solutions:
- Verify GPG key is valid:
gpg --list-secret-keys - Check passphrase is correct
- Ensure key hasn't expired
- Verify key format (ASCII armored)
Issue: Cannot push tags or create releases
Solutions:
- Verify GitHub App is installed on repository
- Check App permissions (Contents: Write)
- Verify App ID and private key are correct
- Ensure App token hasn't expired
Issue: Semantic release calculates incorrect version
Solutions:
- Check commit message format
- Verify branch configuration in
.releaserc - Review previous tags:
git tag -l - Check for BREAKING CHANGE in commit body
Issue: Hotfix branch uses wrong configuration
Solutions:
- Verify branch name matches
hotfix/*pattern - Check
.releaserc.hotfixexists - Review workflow step logs
name: Release
on:
push:
branches: [develop, release-candidate, main]
jobs:
release:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/release.yml@v1.0.0
secrets: inheritname: Release Pipeline
on:
push:
branches: [develop, release-candidate, main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make test
release:
needs: test
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/release.yml@v1.0.0
secrets: inherit
build:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and push
run: make build-pushname: Hotfix Release
on:
push:
branches:
- 'hotfix/**'
jobs:
release:
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/release.yml@v1.0.0
secrets: inherit- @semantic-release/commit-analyzer: Analyzes commits to determine version bump
- @semantic-release/release-notes-generator: Generates release notes from commits
- @semantic-release/github: Creates GitHub releases
- @semantic-release/exec: Executes custom scripts (installed automatically)
- conventional-changelog-conventionalcommits: Conventional commits support
- @saithodev/semantic-release-backmerge: Automatic backmerging
Add custom plugins in .releaserc:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
}- GitOps Update - Update deployments after release
- PR Security Scan - Security checks before release
- API Dog E2E Tests - E2E tests after release