Skip to content

Update README.md (#42) #39

Update README.md (#42)

Update README.md (#42) #39

Workflow file for this run

name: Auto Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
auto-release:
if: "!startsWith(github.event.head_commit.message, 'chore: release v')"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Resolve release version
id: next
run: |
# The version is the source of truth in graphiq-core/Cargo.toml (set by
# a chore(release) bump, e.g. 4.3.0). Read it directly rather than
# computing PATCH+1 — that way merging a version-bump PR tags exactly
# the version the PR set, and a re-run on an unchanged main is a no-op
# (the tag already exists → skip). This avoids the off-by-one where
# auto-release would tag v4.3.1 when the PR bumped to v4.3.0.
VERSION="$(grep '^version = "' crates/graphiq-core/Cargo.toml | head -1 | sed 's/version = "//;s/"//')"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if [ -z "$VERSION" ]; then
echo "could not resolve version from Cargo.toml" >&2
exit 1
fi
if git tag -l "v${VERSION}" | grep -q .; then
echo "Tag v${VERSION} already exists — nothing to release."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "Tagging v${VERSION}."
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Tag and push
if: steps.next.outputs.skip == 'false'
run: |
git tag "v${{ steps.next.outputs.version }}"
git push origin "v${{ steps.next.outputs.version }}"