Skip to content

Commit

Permalink
Adding CI process to versions on PR to master.
Browse files Browse the repository at this point in the history
  • Loading branch information
guyeisenbach committed Feb 25, 2024
1 parent ff7b89a commit f76c103
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci_verify_version.yaml
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 }}

3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
- Added Dockerfile for web application example.
- Bugfix - Sensitive headers are now case-insensitive.
- Block page HTML align with spec.
- Automatically running e2e tests on pull request.
- Automatically running e2e tests on pull request.
- Automatically verify version on pull request to master.

## [v6.11.0](https://github.com/PerimeterX/perimeterx-java-sdk/compare/6.11.0...HEAD) (2024-02-18)
* Added base64-encoded request http method to captcha script query parameters on block pages
Expand Down
8 changes: 8 additions & 0 deletions ci_files/verify-version-inc.sh
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"
3 changes: 2 additions & 1 deletion web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>com.perimeterx</groupId>
<artifactId>perimeterx-sdk</artifactId>
<version>6.11.0</version>
<version>${com.perimeterx.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -64,6 +64,7 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<com.perimeterx.version>6.11.0</com.perimeterx.version>
</properties>

</project>

0 comments on commit f76c103

Please sign in to comment.