Skip to content

Release/v0.0.1 alpha.78 #72

Release/v0.0.1 alpha.78

Release/v0.0.1 alpha.78 #72

# This workflow runs on any PRs that are targeting main and ensures that the version in package.json is incremented
name: Check Version Increment
on:
pull_request:
branches:
- 'main'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true
jobs:
check-version:
name: Check version increment
runs-on: ubuntu-latest
steps:
- uses: Chia-Network/actions/clean-workspace@main
- name: Checkout current branch
uses: actions/checkout@v3
with:
path: branch-repo
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
path: main-repo
- name: Check Versions
run: |
# Extract version from main branch's package.json
mainVersion=$(jq -r '.version' main-repo/package.json)
echo "Main version: $mainVersion"
# Extract version from current branch's package.json
branchVersion=$(jq -r '.version' branch-repo/package.json)
echo "Branch version: $branchVersion"
# Compare versions
if [ "$branchVersion" == "$mainVersion" ]; then
echo "Version in package.json on this branch is not incremented. Version must increment for a merge to main."
exit 1
fi
shell: bash