Skip to content

Prepare release 4.0 #57

Prepare release 4.0

Prepare release 4.0 #57

name: version-check
on:
pull_request:
branches:
- master
paths-ignore:
- '.github/**'
jobs:
release:
name: Check Version
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Version diff
run: |
# read version from file: ZonPHP/inc/version_info.php of head branch
HEAD_VERSION=$( grep '$version = ' ZonPHP/inc/version_info.php | cut -d '"' -f 2 )
echo "HEAD_VERSION --> $HEAD_VERSION"
git checkout master
# read version from file: ZonPHP/inc/version_info.php of master branch
MASTER_VERSION=$( grep '$version = ' ZonPHP/inc/version_info.php | cut -d '"' -f 2 )
echo "MASTER_VERSION --> $MASTER_VERSION"
#if [ "$HEAD_VERSION" \> "$MASTER_VERSION" ]; then
if [ "$(printf '%s\n' "$HEAD_VERSION" "$MASTER_VERSION" | sort -V | head -n 1)" != "$HEAD_VERSION" ]; then
echo "Great job, master version $MASTER_VERSION will become $HEAD_VERSION soon"
else
echo "Head $HEAD_VERSION not updated before merging into master"
exit 1
fi