Skip to content

Add website link in Settings (About section) (#21) #17

Add website link in Settings (About section) (#21)

Add website link in Settings (About section) (#21) #17

Workflow file for this run

name: Auto-tag
# Push-time auto-bump. When a commit lands on main that actually changes
# something user-facing (Sources, Tests, project.yml, bootstrap.sh), this
# fires, inspects conventional-commit subjects since the previous tag to
# decide the bump level, tags, and dispatches the Release workflow.
#
# Bump rules:
# - any commit with `!` before the `:` (e.g. `feat!:`, `fix(scope)!:`)
# or a `BREAKING CHANGE:` footer -> major bump
# - otherwise any `feat(...):` commit -> minor bump
# - otherwise -> patch bump
#
# The manual "Bump & Release" workflow is still available to force a
# specific bump or cut a release out-of-band. For docs-only / dependabot
# / hooks-only commits the paths filter below means this workflow doesn't
# even start, no tag, no release, no inflation.
on:
push:
branches: [main]
paths:
# Only files that affect the produced binary trigger an auto-tag.
# Workflow / CI changes do *not*, that was the source of the
# version-inflation we got while iterating on the workflows themselves.
- "Sources/**"
- "Tests/**"
- "project.yml"
- "bootstrap.sh"
permissions:
contents: write
actions: write # required by `gh workflow run` to dispatch Release
concurrency:
group: auto-tag-main
cancel-in-progress: true
jobs:
tag:
name: Compute & push tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Skip if HEAD already has a v* tag
# If the commit is already tagged (e.g. the Bump & Release workflow
# just put one here) there's nothing to do, and re-tagging would
# collide. Sets `skip=true` for downstream conditions.
id: skip
run: |
if git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' >/dev/null; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "HEAD is already tagged: $(git tag --points-at HEAD | tr '\n' ' ')"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Compute next version from conventional commits
if: steps.skip.outputs.skip == 'false'
id: next
run: |
LAST=$(git describe --tags --abbrev=0 --match 'v*' 2>/dev/null || echo "v0.0.0")
BASE="${LAST#v}"
MAJOR=$(echo "$BASE" | cut -d. -f1)
MINOR=$(echo "$BASE" | cut -d. -f2)
PATCH=$(echo "$BASE" | cut -d. -f3)
# Commits to inspect: everything new since the previous tag. If
# there is no previous tag we look at the whole history.
if [[ "$LAST" == "v0.0.0" ]]; then
RANGE="HEAD"
else
RANGE="${LAST}..HEAD"
fi
BUMP="patch"
# `!` before the `:` in the subject, OR a `BREAKING CHANGE:`
# footer anywhere in the message → major.
if git log "$RANGE" --format='%B' \
| grep -qE '^[a-zA-Z]+(\([^)]+\))?!:|^BREAKING CHANGE:'; then
BUMP="major"
elif git log "$RANGE" --format='%s' \
| grep -qE '^feat(\([^)]+\))?:'; then
BUMP="minor"
fi
case "$BUMP" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
esac
NEW="v${MAJOR}.${MINOR}.${PATCH}"
echo "tag=$NEW" >> "$GITHUB_OUTPUT"
echo "previous=$LAST" >> "$GITHUB_OUTPUT"
echo "bump=$BUMP" >> "$GITHUB_OUTPUT"
echo "Bumping $LAST → $NEW ($BUMP, auto)"
- name: Create and push annotated tag
if: steps.skip.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.next.outputs.tag }}" \
-m "Release ${{ steps.next.outputs.tag }} (auto-tagged from ${{ github.sha }})"
git push origin "${{ steps.next.outputs.tag }}"
- name: Trigger Release workflow
# Tags pushed by GITHUB_TOKEN don't trigger downstream workflows
# (GitHub's anti-infinite-loop), so dispatch Release explicitly.
if: steps.skip.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run release.yml \
--repo "${{ github.repository }}" \
-f tag="${{ steps.next.outputs.tag }}"
- name: Summary
run: |
{
if [[ "${{ steps.skip.outputs.skip }}" == "true" ]]; then
echo "## Skipped"
echo "HEAD already has a v* tag, nothing to do."
else
echo "## Tagged ${{ steps.next.outputs.tag }}"
echo ""
echo "- Previous: \`${{ steps.next.outputs.previous }}\`"
echo "- New: \`${{ steps.next.outputs.tag }}\`"
echo "- Bump: \`${{ steps.next.outputs.bump }}\` (from conventional-commit subjects)"
echo ""
echo "Release workflow will fire on the tag push and produce a draft GitHub Release with the DMG."
fi
} >> "$GITHUB_STEP_SUMMARY"