CI/CD & GitHub Actions (50 Qs)•Part 3: Enterprise Scale, Compliance & Production Hardening (Senior / Staff)
Automated Release Management with Semantic Release and Conventional Commits.
senior LevelCode ExamplecicdEnterprise Scale
In Simple Words:
Automated release pipelines inspect commit messages to determine the next Semantic Version (MAJOR.MINOR.PATCH), generate changelogs, tag Git repositories, and publish packages without human intervention.
yaml
name: Semantic Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SEMANTIC_RELEASE_PAT }}
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
fix:bumps the PATCH version (e.g. 1.2.0 -> 1.2.1).feat:bumps the MINOR version (e.g. 1.2.0 -> 1.3.0).BREAKING CHANGE:orfeat!:bumps the MAJOR version (e.g. 1.2.0 -> 2.0.0).