Automatic versioning based on existing releases and commit changes.
It works by taking the latest tag release, looping over every commit in the push request, and applying a major or minor patch based on the commits' changes. (major patches for added or renamed files, minor patches for changed or deleted files)
If you do not already have a github workflow, check out how to make and use one.
To generate versioning data, add a new step inside of your workflow:
- name: Gen Versioning Data
id: versioning
uses: Soumeh/Auto-Versioning@main
To get (and use) the versioning data, you have to use the magic Github keyword ${{ steps.(id).outputs.(output) }}
, Where (id) is the id
value in the above step, and (output) is one of the values below:
Output | Description |
---|---|
tag |
The new version generated by the action. |
raw-changelog |
A JSON object with the raw changelog data. |
changelog |
A fancy list of changes made in the pull request. |
Examples of the
changelog
andraw-changelog
values.
Added:
• `new_file.txt`
Modified:
• `other_file.txt`
Removed:
• `useless_file.txt`
Renamed:
• `oldfilename.txt` → `new_filename.txt`
{
"added": "new_file.txt",
"modified": "other_file.txt",
"removed": "useless_file.txt",
"renamed": [ "oldfilename.txt", "new_filename.txt" ]
}
Creates a new release of the repository with the tag set as the new version, and the body containing a changelog.
name: Integration Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Get Versioning Data
id: versioning
uses: Soumeh/Auto-Versioning@main
- name: Create Release
uses: meeDamian/github-release@2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
# names the release after the head commit
name: ${{ github.event.head_commit.message }}
tag: ${{ steps.versioning.outputs.tag }}
body: "${{ steps.versioning.outputs.changelog }}"
gzip: false