Skip to content

Surface MLX feature parity in user-facing docs (#321) #47

Surface MLX feature parity in user-facing docs (#321)

Surface MLX feature parity in user-facing docs (#321) #47

Workflow file for this run

name: Auto bump dev
# Increments the PEP 440 `.devN` suffix on `dev` after every push that carries
# real work, so each commit on the branch has its own pre-release version and an
# installed dev build is always identifiable. The clean version and the tag are
# owned by auto-tag.yml when dev merges into main.
#
# Skips when the push is this bot's own bump (else it loops), when the message
# already starts with the bump prefix, or when a commit opts out with
# [skip-bump].
on:
push:
branches: [dev]
permissions:
contents: write
jobs:
bump:
if: |
github.event.head_commit.author.email != 'pamica-bot@users.noreply.github.com'
&& !startsWith(github.event.head_commit.message, 'Bump version to')
&& !contains(github.event.head_commit.message, '[skip-bump]')
runs-on: ubuntu-latest
steps:
- name: Require the release PAT
# Pushes and releases made with the default GITHUB_TOKEN do not trigger
# other workflows, so without a PAT this job would appear to succeed
# while silently never publishing. Fail visibly instead.
env:
PAT: ${{ secrets.AUTO_TAG_PAT }}
run: |
if [ -z "$PAT" ]; then
echo "::error::AUTO_TAG_PAT is not set. Create a repository secret with a PAT that has contents:write, or the release chain cannot fire."
exit 1
fi
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 2
# A PAT is required to push back to a protected dev branch; the
# default GITHUB_TOKEN cannot write through branch protection.
token: ${{ secrets.AUTO_TAG_PAT }}
- name: Compute next dev suffix
id: compute
run: |
CURRENT=$(grep -m1 '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
# dev should always carry a .devN. Anything else means a release just
# landed and sync-dev has not fired yet, or a human is mid-release --
# log and leave it alone rather than guessing an intent.
if [[ ! "$CURRENT" =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.dev([0-9]+)$ ]]; then
echo "::notice::$CURRENT has no .devN suffix; leaving dev as-is."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "next=${BASH_REMATCH[1]}.dev$(( ${BASH_REMATCH[2]} + 1 ))" >> "$GITHUB_OUTPUT"
echo "skip=false" >> "$GITHUB_OUTPUT"
- name: Install uv
if: steps.compute.outputs.skip == 'false'
uses: astral-sh/setup-uv@v5
- name: Bump and push
if: steps.compute.outputs.skip == 'false'
run: |
git config user.name "pamica-bot"
git config user.email "pamica-bot@users.noreply.github.com"
# sync_version.py writes all three metadata files together; uv.lock
# records the project version, so it has to follow.
uv run python scripts/sync_version.py sync "${{ steps.compute.outputs.next }}"
uv lock
git add pyproject.toml CITATION.cff .zenodo.json uv.lock
# Tolerate a no-op: re-running after a partial bump leaves nothing
# staged, and failing there would be noise, not a signal.
git diff --cached --quiet || git commit -m "Bump version to ${{ steps.compute.outputs.next }}"
# A concurrent push wins; this workflow re-fires from the new HEAD.
git push origin dev || echo "::warning::push to dev rejected (concurrent push); skipping"