-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding CI process to versions on PR to master.
- Loading branch information
1 parent
ff7b89a
commit 0dc3126
Showing
4 changed files
with
56 additions
and
2 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,44 @@ | ||
name: Verify version | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
verify-version: | ||
name: Verify version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code - ${{ github.base_ref }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.base_ref }} | ||
|
||
- name: Get ${{ github.base_ref }} SDK version | ||
id: base-version | ||
run: echo "project=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Checkout code - current commit | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get current SDK versions | ||
id: new-version | ||
run: | | ||
echo "project=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )" >> "$GITHUB_OUTPUT" && \ | ||
echo "px_metadata=$( cat px_metadata.json | jq -r '.version' )" >> "$GITHUB_OUTPUT" && \ | ||
echo "demo_app_dependency=$( mvn help:evaluate -Dexpression=com.perimeterx.version -q -DforceStdout -f web/pom.xml)" >> "$GITHUB_OUTPUT" | ||
- name: Verify same version | ||
run: | | ||
[ $PROJECT_VERSION = $PX_METADATA_VERSION ] && \ | ||
[ $PROJECT_VERSION = $DEMO_APP_DEPENDENCY_VERSION ] | ||
env: | ||
PROJECT_VERSION: ${{ steps.new-version.outputs.project }} | ||
PX_METADATA_VERSION: ${{ steps.new-version.outputs.px_metadata }} | ||
DEMO_APP_DEPENDENCY_VERSION: ${{ steps.new-version.outputs.demo_app_dependency }} | ||
|
||
- name: Verify version increment | ||
run: ./ci_files/verify-version-inc.sh $BASE_VERSION $NEW_VERSION | ||
env: | ||
NEW_VERSION: ${{ steps.new-version.outputs.project }} | ||
BASE_VERSION: ${{ steps.base-version.outputs.project }} | ||
|
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
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,8 @@ | ||
versionlte() { | ||
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ] | ||
} | ||
versionlt() { | ||
[ "$1" != "$2" ] && versionlte "$1" "$2" | ||
} | ||
|
||
versionlt "$1" "$2" |
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