Speed up your release process: create a tag to trigger a new GitHub release, automatically update your changelog with release details, and receive a pull request with the latest changelog changes.
Create .github/workflows/release.yml:
name: Release
on:
push:
tags: ['v*.*.*']
jobs:
release:
# Use @main for newest version, or pin to specific version like @v1.0.0
uses: rocajuanma/simple-release/.github/workflows/reusable-release.yml@main
with:
changelog-path: 'CHANGELOG.md' # Optional: Changelog path
secrets:
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Optional: For creating releasesCreate .github/workflows/post-release-changelog.yml:
name: Post-Release Changelog Update
on:
repository_dispatch:
types: [release-published]
jobs:
update-changelog:
# Use @main for newest version, or pin to specific version like @v1.0.0
uses: rocajuanma/simple-release/.github/workflows/reusable-post-release-changelog.yml@main
secrets:
TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required: Creates PR and updates changelogNote: Each workflow uses different secret names:
- Release workflow: Uses
RELEASE_TOKEN(optional) for creating releases- Post-release workflow: Uses
TOKEN(required) for creating PRs and updating changelogYou can pass your
GITHUB_TOKENto both, or create a Personal Access Token (PAT) withrepopermissions and add it as a repository secret.
Create CHANGELOG.md:
# Changelog
## [Unreleased]
### Added
- Your new features here
## [1.0.0] - 2024-01-01
### Added
- Initial releaseNote: As long as you keep your
CHANGELOG.mdup to date after each change, this workflow > will automatically move all items under "Unreleased" into a new release section whenever you > push a new tag.
- Push a tag:
git tag v1.0.0 && git push origin v1.0.0 - Release created with changelog content (no files attached)
- Changelog updated automatically
- PR created with changelog changes
- Always gets the newest version with latest fixes and features
- Automatic updates when new changes are pushed to main
- Best for most users who want the latest functionality
uses: rocajuanma/simple-release/.github/workflows/reusable-release.yml@main- Use for production where you need stability
- Prevents unexpected changes from automatic updates
- Update manually when you want new features
uses: rocajuanma/simple-release/workflows/[email protected]Check releases page for all available versions.
GITHUB_TOKEN: Automatically provided by GitHub Actions- Permissions needed:
contents: write(to update changelog)pull-requests: write(to create PR)metadata: read(to read repository info)
- Fallback option: If default token fails, create a Personal Access Token (PAT) with
reposcope and add as repository secret
If the post-release workflow fails to create PRs:
- Create a PAT: Go to GitHub Settings → Developer settings → Personal access tokens
- Required scope: Select
repo(full repository access) - Add as secret: Repository Settings → Secrets → Add
GITHUB_TOKENwith your PAT - Test: Push a new tag to verify the workflow works
Note: For production use, consider pinning to specific version tags (e.g.,
@v1.0.0) instead of@mainto ensure you're using a stable, tested version.
