Skip to content

[minor]: Binomial guarantees #6

[minor]: Binomial guarantees

[minor]: Binomial guarantees #6

Workflow file for this run

# ❣❣❣ DO NOT EDIT ❣ THIS FILE IS AUTOMATICALLY SYNCED ❣ DO NOT EDIT ❣❣❣
name: Semantic release
permissions:
contents: write
on:
pull_request_target:
types:
- closed
branches:
- master
jobs:
release:
name: Release
# ensures this only runs if the PR was actually merged, not just closed unmerged
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
type: ${{ steps.parse.outputs.type }}
version: ${{ steps.increment.outputs.version }}
steps:
- name: ⚡ Checkout repository ⚡
uses: actions/checkout@v6
with:
# fetch all history so the workflow can find previous tags
fetch-depth: 0
- name: ⚡ Parse bump type ⚡
id: parse
env:
# note: do not interpolate PR title using standard bash double quotes, it
# can contain backticks
TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ "$TITLE" =~ ^\[major\] ]]; then
echo "type=major" >> "$GITHUB_OUTPUT"
elif [[ "$TITLE" =~ ^\[minor\] ]]; then
echo "type=minor" >> "$GITHUB_OUTPUT"
elif [[ "$TITLE" =~ ^\[patch\] ]]; then
echo "type=patch" >> "$GITHUB_OUTPUT"
else
# Handles [none] or any PR title that lacks a recognized specifier
echo "type=none" >> "$GITHUB_OUTPUT"
fi
- name: ⚡ Increment version ⚡
id: increment
if: steps.parse.outputs.type != 'none'
run: |
LATEST_VERSION=$(git tag | sed -E -n 's/^v//; /^[0-9]+\.[0-9]+\.[0-9]+$/p' | sort -V | tail -n 1)
if [ -z "$LATEST_VERSION" ]; then
LATEST_VERSION="0.0.0"
fi
echo "Current highest version identified: $LATEST_VERSION"
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
if [ "${{ steps.parse.outputs.type }}" == "major" ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [ "${{ steps.parse.outputs.type }}" == "minor" ]; then
MINOR=$((MINOR + 1))
PATCH=0
elif [ "${{ steps.parse.outputs.type }}" == "patch" ]; then
PATCH=$((PATCH + 1))
fi
NEXT_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
publish:
name: Publish Release
needs:
- release
if: needs.release.outputs.type != 'none'
runs-on: ubuntu-24.04-arm
env:
# toggle to 'false' to only push the tag and skip creating the GitHub Release
CREATE_RELEASE: 'true'
steps:
- name: ⚡ Checkout repository ⚡
uses: actions/checkout@v6
- name: ⚡ Install rarestcheck tool ⚡
uses: rarestype/r2-install-action@v1
with:
tracker: rarestype/rarestcheck
project: rarestcheck
archive: rarestcheck.tar.gz
- name: ⚡ Configure git ⚡
run: |
git config user.name "rarest automation"
git config user.email "automation@noreply.rarestype.com"
- name: ⚡ Run README hook ⚡
run: |
if [ -f README.md ]; then
rarestcheck sync-readme README.md \
--repo ${{ github.repository }} \
--version ${{ needs.release.outputs.version }}
git add README.md
fi
- name: ⚡ Create tag ⚡
run: |
# if the pre-release script modified anything but the README, abort release
git diff --exit-code
git commit \
--allow-empty \
-m "[release]: ${{ needs.release.outputs.version }}"
git tag "${{ needs.release.outputs.version }}"
git push origin "${{ needs.release.outputs.version }}"
git push
- name: ⚡ Create release ⚡
if: env.CREATE_RELEASE == 'true'
run: |
gh release create "${{ needs.release.outputs.version }}" \
--title "${{ needs.release.outputs.version }}" \
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}