Automated commit at Sun May 5 07:00:00 CEST 2024

This commit is contained in:
Mischa van den Burg 2024-05-05 07:00:00 +02:00
parent 02fd66cd9d
commit 4894089ccf
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,54 @@
I used the following action from the marketplace for increasing the versions based on conventional commits:
[Semver Conventional Commits · Actions · GitHub Marketplace](https://github.com/marketplace/actions/semver-conventional-commits)
In the example below, I'm running a separate job to increase the version based on the latest tag of the repository. The job has an output which I can use later to tag the images themselves.
```yaml
jobs:
prepare_tag:
outputs:
tag: ${{ steps.semver.outputs.next }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Defaults to patch version, will bump minor on "feat" commit
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: master
patchAll: true
- name: Push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.semver.outputs.next }}
tag_prefix: ""
```
The Get Next Version step increments the version based on the configuration provided. I used the `patchAll: true` setting to always default on a patch incrementation if the word "feat" is not in the commit. If the commit would contain "BREAKING CHANGE", the major version would be incremented.
To push the new version to the current repo, I used this action:
[GitHub Tag · Actions · GitHub Marketplace](https://github.com/marketplace/actions/github-tag)
Since the semver-action already adds a "v" to the tag, I adjusted the `tag_prefix` to `""`.
## Links:
202404291453

View File

@ -1,5 +1,6 @@
Actions
- [[Building multiple Docker images using automatic versioning using GitHub Actions - index]]
- [[Creating tags based on conventional commits with github actions]]
## Links: