Skip to content

Holiday Updated

Holiday Updated #183

Workflow file for this run

name: Version Increment Check
on:
pull_request:
branches:
- gh-pages # Ensure this matches your base branch
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout destination branch (gh-pages)
uses: actions/checkout@v5
with:
ref: gh-pages
path: base
- name: Checkout pull request branch
uses: actions/checkout@v5
with:
path: pr
- name: Extract version from base branch
id: base_version
run: |
BASE_VERSION=$(grep '^version:' base/_config.yml | sed 's/version: //' | tr -d '[:space:]')
echo "Base branch version: $BASE_VERSION"
echo "VERSION=$BASE_VERSION" >> $GITHUB_ENV
- name: Extract version from PR branch
id: pr_version
run: |
PR_VERSION=$(grep '^version:' pr/_config.yml | sed 's/version: //' | tr -d '[:space:]')
echo "Pull request branch version: $PR_VERSION"
echo "VERSION_PR=$PR_VERSION" >> $GITHUB_ENV
- name: Compare versions
run: |
echo "Comparing versions..."
echo "Base: $VERSION, PR: $VERSION_PR"
# Ensure both versions are extracted
if [[ -z "$VERSION" || -z "$VERSION_PR" ]]; then
echo "❌ Error: Could not extract versions properly."
exit 1
fi
# Check if the PR version is the same as the base version
if [[ "$VERSION" == "$VERSION_PR" ]]; then
echo "❌ Error: Version number has NOT changed! Please update _config.yml."
exit 1
fi
# Check if the new version is actually greater
if [ "$(printf '%s\n' "$VERSION" "$VERSION_PR" | sort -V | tail -n 1)" != "$VERSION_PR" ]; then
echo "❌ Error: Version number has not incremented! Please update _config.yml."
exit 1
else
echo "βœ… Version increment check passed."
fi
env:
VERSION: ${{ env.VERSION }}
VERSION_PR: ${{ env.VERSION_PR }}