Skip to content

ci: add auto-beta workflow that increments on every push to main #1

ci: add auto-beta workflow that increments on every push to main

ci: add auto-beta workflow that increments on every push to main #1

Workflow file for this run

name: Auto Beta
on:
push:
branches:
- main
jobs:
beta:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute next beta version
id: version
run: |
# Find the latest manually-created base tag (e.g. v0.0.4-beta)
# Pattern: vX.Y.Z-beta with nothing after (no dot-number suffix)
LATEST_BASE=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*-beta' \
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-beta$' \
| sort -V | tail -1)
if [ -z "$LATEST_BASE" ]; then
echo "No manual beta base tag found, defaulting to v0.0.1-beta"
LATEST_BASE="v0.0.1-beta"
fi
echo "Base version: ${LATEST_BASE}"
# Find the highest auto-increment tag for this base (e.g. v0.0.4-beta.3)
HIGHEST=$(git tag -l "${LATEST_BASE}.[0-9]*" | sort -V | tail -1)
if [ -z "$HIGHEST" ]; then
NEXT="${LATEST_BASE}.1"
else
N="${HIGHEST##*.}"
NEXT="${LATEST_BASE}.$((N + 1))"
fi
echo "Next version: ${NEXT}"
echo "version=${NEXT}" >> "$GITHUB_OUTPUT"
- name: Create tag
run: |
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}
- name: Create pre-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
prerelease: true
generate_release_notes: true