Skip to content

Commit

Permalink
Set up check version script, add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScorpion committed Oct 12, 2023
1 parent f6fcf28 commit 71f593d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Check Versions

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./check-versions.sh
32 changes: 32 additions & 0 deletions check-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail

if ( ! command -v jq > /dev/null )
then
echo 'The jq command is required for this script.'
exit 1
fi

allMatch=1
function checkVersionMatch() {
echo "- $1: $2"
if [ ! "$composerVersion" = "$2" ]
then
allMatch=0
fi
}

echo "Detected versions:"

composerVersion=$(jq -r .version 'composer.json')
checkVersionMatch 'composer.json' "$composerVersion"

checkVersionMatch 'CHANGELOG.md' "$(sed -nE 's/^## (.*) -.*$/\1/p' 'CHANGELOG.md' | head -n 1)"

if [ ! "$allMatch" = 1 ]
then
echo 'Not all versions match.'
exit 1
else
echo 'All version match!'
fi

0 comments on commit 71f593d

Please sign in to comment.