Skip to content

feat: improve CLI setup and project creation #20

feat: improve CLI setup and project creation

feat: improve CLI setup and project creation #20

Workflow file for this run

name: Auto Release
on:
push:
branches: [main]
permissions:
contents: write
actions: write
# Serialize runs so concurrent pushes cannot compute the same next version.
concurrency:
group: auto-release
cancel-in-progress: false
jobs:
tag:
name: Tag next version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
# Conventional-commit bump since the last v* tag:
# type!: / BREAKING CHANGE: -> major (minor while pre-1.0)
# feat: -> minor
# fix: / perf: -> patch
# anything else -> no release
- name: Compute next version
id: version
shell: bash
run: |
last_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
range=""
if [[ -n "$last_tag" ]]; then
range="$last_tag..HEAD"
fi
subjects="$(git log --format='%s' $range)"
bodies="$(git log --format='%b' $range)"
bump=none
if grep -qE '^[a-z]+(\([^)]+\))?!: ' <<<"$subjects" || grep -qE '^BREAKING[ -]CHANGE: ' <<<"$bodies"; then
bump=major
elif grep -qE '^feat(\([^)]+\))?: ' <<<"$subjects"; then
bump=minor
elif grep -qE '^(fix|perf)(\([^)]+\))?: ' <<<"$subjects"; then
bump=patch
fi
if [[ "$bump" == none ]]; then
echo "No releasable commits since ${last_tag:-the first commit} — skipping release."
echo "tag=" >> "$GITHUB_OUTPUT"
exit 0
fi
if [[ -z "$last_tag" ]]; then
next="0.1.0"
else
IFS=. read -r major minor patch <<<"${last_tag#v}"
if [[ "$major" == 0 && "$bump" == major ]]; then
bump=minor
fi
case "$bump" in
major) next="$((major + 1)).0.0" ;;
minor) next="$major.$((minor + 1)).0" ;;
patch) next="$major.$minor.$((patch + 1))" ;;
esac
fi
echo "Releasing v$next ($bump bump since ${last_tag:-the first commit})."
echo "tag=v$next" >> "$GITHUB_OUTPUT"
- name: Push tag
if: steps.version.outputs.tag != ''
shell: bash
run: |
git tag "${{ steps.version.outputs.tag }}" "$GITHUB_SHA"
git push origin "refs/tags/${{ steps.version.outputs.tag }}"
# Tags pushed with the workflow token do not fire the tag-push event
# (GitHub suppresses recursive workflow triggers), so the release
# workflow is dispatched on the new tag explicitly.
- name: Dispatch release workflow
if: steps.version.outputs.tag != ''
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run release.yml --repo "$GITHUB_REPOSITORY" --ref "${{ steps.version.outputs.tag }}"