Skip to content

Release v1.1.0 Arcana #12

Release v1.1.0 Arcana

Release v1.1.0 Arcana #12

Workflow file for this run

name: Version Checks
on:
pull_request:
branches:
- main
jobs:
version_check:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Extract Branch Name
run: |
echo "PR head ref: ${{ github.head_ref }}"
BRANCH_NAME="${{ github.head_ref }}"
echo "Branch Name: $BRANCH_NAME"
- name: Determine Expected Version
id: expected_version
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
if [[ "$BRANCH_NAME" == rc/* ]]; then
EXPECTED_VERSION="${BRANCH_NAME#rc/}"
echo "version=$EXPECTED_VERSION" >> $GITHUB_ENV
elif [[ "$BRANCH_NAME" == hotfix/* ]]; then
git fetch --tags
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
if [ -z "$LATEST_TAG" ]; then
echo "No existing tags found. Cannot proceed with hotfix versioning."
exit 1
fi
IFS='.' read -r -a VERSION_PARTS <<< "${LATEST_TAG#v}"
MAJOR="${VERSION_PARTS[0]}"
MINOR="${VERSION_PARTS[1]}"
PATCH="${VERSION_PARTS[2]}"
PATCH=$((PATCH + 1))
EXPECTED_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "version=$EXPECTED_VERSION" >> $GITHUB_ENV
else
echo "Not an rc/* or hotfix/* branch. Skipping version check."
exit 0
fi
- name: Check Version Consistency
if: steps.expected_version.outputs.version
run: |
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -n 1 | awk -F\" '{print $2}')
echo "Version in Cargo.toml: $CARGO_VERSION"
echo "Expected version: ${{ steps.expected_version.outputs.version }}"
if [ "$CARGO_VERSION" != "${{ steps.expected_version.outputs.version }}" ]; then
echo "Version mismatch! Cargo.toml version ($CARGO_VERSION) does not match expected version (${{ steps.expected_version.outputs.version }})."
exit 1
else
echo "Version matches."
fi