Skip to content

Commit

Permalink
ci: enable automatic semantic versioning using Conventional Commits
Browse files Browse the repository at this point in the history
The version bumps can be controlled using https://www.conventionalcommits.org
commit messages.
  • Loading branch information
alecthomas committed Aug 25, 2023
1 parent e9fcdc7 commit 7762104
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/autoversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
workflow_call:
jobs:
semver-tag:
name: Conventional Commits Auto-version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Auto-version
id: autoversion
run: scripts/autoversion
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ jobs:
name: Integration Tests
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/integration.yml
release:
name: Release
autoversion:
name: Auto Version
if: github.ref == 'refs/heads/main'
needs:
- kotlin-runtime
Expand All @@ -114,4 +114,5 @@ jobs:
- lint
- console
- integration
uses: ./.github/workflows/release.yml
- sql
uses: ./.github/workflows/autoversion.yml
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
on:
workflow_call:
push:
tags:
- v**
name: Build Docker Images
jobs:
build-runner:
Expand Down
1 change: 1 addition & 0 deletions bin/.svu-1.11.0.pkg
1 change: 1 addition & 0 deletions bin/svu
12 changes: 12 additions & 0 deletions scripts/autoversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail

old_version="$(svu current)"
new_version="$(svu next)"

test "${old_version}" = "${new_version}" && { echo "No version change"; exit 0; }

gh api -H "Accept: application/vnd.github.v3+json" \
"/repos/{owner}/{repo}/git/refs" \
-f ref="refs/tags/${new_version}" \
-f sha="$(git rev-parse HEAD)"

0 comments on commit 7762104

Please sign in to comment.