Skip to content

Release 0.3.0: version bump, changelog, docs version #48

Release 0.3.0: version bump, changelog, docs version

Release 0.3.0: version bump, changelog, docs version #48

Workflow file for this run

name: Automatic Versioning
on:
push:
branches:
- master # change to main if that's your default
workflow_dispatch:
permissions:
contents: write
jobs:
versioning:
runs-on: ubuntu-latest
steps:
- name: Checkout (with tags)
uses: actions/checkout@v4
with:
fetch-depth: 0 # IMPORTANT: allows tags/history
- name: Get latest tag
id: latest
run: |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo v0.0.0)
echo "Latest tag: $latest_tag"
echo "tag=$latest_tag" >> "$GITHUB_OUTPUT"
- name: Determine version bump
id: bump
run: |
latest_version="${{ steps.latest.outputs.tag }}"
commit_message=$(git log -1 --pretty=%B)
major=$(echo "$latest_version" | cut -d. -f1 | sed 's/^v//')
minor=$(echo "$latest_version" | cut -d. -f2)
patch=$(echo "$latest_version" | cut -d. -f3)
if echo "$commit_message" | grep -q "\[API Change\]"; then
new_version="v$((major + 1)).0.0"
elif echo "$commit_message" | grep -q "\[Feature\]"; then
new_version="v$major.$((minor + 1)).0"
elif echo "$commit_message" | grep -q "\[Patch\]"; then
new_version="v$major.$minor.$((patch + 1))"
else
echo "No versioning keyword found. Skipping tagging."
echo "new_version=" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "New version: $new_version"
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
- name: Create and push tag
if: ${{ steps.bump.outputs.new_version != '' }}
run: |
git config user.name "github-actions"
git config user.email "actions@users.noreply.github.com"
git tag "${{ steps.bump.outputs.new_version }}"
git push origin "${{ steps.bump.outputs.new_version }}"
- name: Trigger Release Workflow
if: ${{ steps.bump.outputs.new_version != '' }}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Engine
token: ${{ secrets.GITHUB_TOKEN }}