-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up check version script, add CI workflow
- Loading branch information
1 parent
f6fcf28
commit 71f593d
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |