GitHub Action designed as companion for release-drafter to determine the next semantic version based on the github labels of merged pull requests
To use the action, create a yaml file ( i.e. version.yml
) in your .github/workflows
folder
name: Update Releaseinfo
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
jobs:
update_version:
runs-on: ubuntu-latest
steps:
- name: calculate next version
id: version
uses: patrickjahns/version-drafter-action@v1
with:
# (Optional) specify config name to use, relative to .github/. Default: version-drafter.yml
# config-name: my-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: echo calculated version
run: |
echo "version: ${{ steps.version.outputs.next-version }}"
name: Update Releaseinfo
on:
push:
branches:
- master
jobs:
update_version:
runs-on: ubuntu-latest
steps:
- name: calculate next version
id: version
uses: patrickjahns/version-drafter-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: release-drafter/release-drafter@master
with:
version: ${{ format('v{0}', steps.version.outputs.next-version) }}
tag: ${{ format('v{0}', steps.version.outputs.next-version) }}
name: ${{ format('v{0}', steps.version.outputs.next-version) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The action determines the next semantic version based on github labels. The mapping of the labels can be configured by
providing a yaml configuration (usually at .github/version-drafter.yml
)
major-labels: ['semver:major']
minor-labels: ['semver:minor','enhancement']
patch-labels: ['semver:patch','bug']
The action will output the calculated next semantic version as next-version
, as well as the current tag as current-version