Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

permissions:
contents: read

on:
push:
branches: [main]

concurrency:
group: release
cancel-in-progress: false

jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Full history and tags, to compute the next version.
fetch-depth: 0

- name: Create the next semver tag and release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
last=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -1)
if [ -z "$last" ]; then
next="v1.0.0"
else
if [ "$(git rev-parse "${last}^{commit}")" = "$GITHUB_SHA" ]; then
echo "HEAD is already released as $last"
exit 0
fi
IFS=. read -r maj min pat <<<"${last#v}"
git log --format=%s "${last}..HEAD" >/tmp/subjects.txt
git log --format=%b "${last}..HEAD" >/tmp/bodies.txt
if grep -qE '^[a-z]+(\([^)]*\))?!:' /tmp/subjects.txt || grep -q '^BREAKING CHANGE:' /tmp/bodies.txt; then
next="v$((maj + 1)).0.0"
elif grep -qE '^feat(\([^)]*\))?:' /tmp/subjects.txt; then
next="v${maj}.$((min + 1)).0"
else
next="v${maj}.${min}.$((pat + 1))"
fi
fi
gh release create "$next" --target "$GITHUB_SHA" --generate-notes
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ jobs:

## Versioning

- All workflow references use **SHA pinning** (no `@v1` tags)
- SHA pins are auto-updated by **Renovate** (Dependabot is not used)
- Every push to `main` is tagged and released automatically
([release.yml](.github/workflows/release.yml)); the semver bump is derived
from the conventional commit types since the last tag
- Consumers reference workflows/actions as `@<sha> # vX.Y.Z`; Renovate bumps
the pins against the tags (Dependabot is not used)

## Composite Actions

Expand Down