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.rc
file in your repo initialized to1.0
(or whatever your current version is) - Create a
.github/workflows/versioning.yml
in 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@v1
New 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.2
tag pointing at your commit - Move the
v1
andv1.0
tags 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.1
andv1.1.0
tags pointing at your commit - Move the
v1
tag 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.0
tags 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.0
onmain
- Create a new branch from your last
v1
release. e.g.git fetch origin --tags # get up to date tags from origin
git checkout v1 # get latest v1 release
git checkout -b releases/v1 # create a branch for v1 releases
git push origin releases/v1 # push it back to the repo
- Continue making PRs and commits against either
main
orreleases/v1
depending on your target
This repo is also auto-versioned using its own script