Implements tag-based verisoning based on Github Action Versioning Recommendations.
On every push to main branches, major, minor, and patch version tags are updated and published.
Major and minor versions are controlled by a version.rc file checked in to the branch, and patch versions are auto-incremented.
- Create a
version.rcfile in your repo initialized to1.0(or whatever your current version is) - Create a
.github/workflows/versioning.ymlin your repository with the following content:
name: Action Versioning
on:
push:
branches:
- main
- releases/** # If you need to maintain an old major or minor version, branch it to (e.g.) releases/v1
jobs:
versioning:
name: "Release"
permissions:
contents: write
uses: ProdigySim/action-versioning-workflow/.github/workflows/action_versioning.yml@v1New patch versions will automatically be created on commits to main.
To publish a new major or minor version, bump the version in version.rc and commit it back to main.
Any changes to main will be picked up by the versioning workflow and your tags will be updated based on the values in version.rc and the previously published patch version for the given major and minor versions.
If your latest published version is v1.0.1, and you push another commit to main without touching version.rc, this workflow will:
- Publish a new
v1.0.2tag pointing at your commit - Move the
v1andv1.0tags to point at your commit
If your latest published version is v1.0.9, and you push a commit to main that bumps versions.rc to 1.1, this workflow will:
- Publish new
v1.1andv1.1.0tags pointing at your commit - Move the
v1tag to point at your commit
If your latest published version is v1.0.15, and you push a commit to main that bumps versions.rc to 2.0, this workflow will:
- Publish new
v2,v2.0, andv2.0.0tags pointing at your commit
This workflow can support development on old versions when using the branch triggers defined in "Installation" by moving development of those branches to release/<something>.
For example, if you want to release a v2, but continue releasing patches on v1, you can:
- Release your version bump to
2.0onmain - Create a new branch from your last
v1release. e.g.git fetch origin --tags # get up to date tags from origingit checkout v1 # get latest v1 releasegit checkout -b releases/v1 # create a branch for v1 releasesgit push origin releases/v1 # push it back to the repo
- Continue making PRs and commits against either
mainorreleases/v1depending on your target
This repo is also auto-versioned using its own script