diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4170bc4..b413251 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -31,7 +31,7 @@ jobs: npm install google-java-format npx google-java-format --set-exit-if-changed -i $(git ls-files src/test/\*.java) - name: Cache local Maven repository - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -40,6 +40,7 @@ jobs: - name: Build with Maven run: mvn -B package --file pom.xml -Dmaven.test.skip - name: Run integration tests with Maven + if: ${{ github.repository_owner == 'onfido' }} run: mvn test env: ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }} @@ -52,6 +53,7 @@ jobs: publish: runs-on: ubuntu-latest needs: integration-tests + environment: delivery if: github.event_name == 'release' steps: - uses: actions/checkout@v4 @@ -79,3 +81,31 @@ jobs: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + - name: Update CHANGELOG.md + run: | + TMP_FILE=$(mktemp) + + RELEASE_VERSION=$(jq -r '.release' .release.json) + RELEASE_DATE=`date +'%dth %B %Y' | sed -E 's/^0//;s/^([2,3]?)1th/\11st/;s/^([2]?)2th/\12nd/;s/^([2]?)3th/\13rd/'` + + SPEC_COMMIT_SHA=$(jq -r '.source.short_sha' .release.json) + SPEC_COMMIT_URL=$(jq -r '.source.repo_url + "/commit/" + .source.long_sha' .release.json) + SPEC_RELEASE_VERSION=$(jq -r '.source.version' .release.json) + SPEC_RELEASE_URL=$(jq -r '.source.repo_url + "/releases/tag/" + .source.version' .release.json) + + echo -e "# Changelog\n\n## $RELEASE_VERSION $RELEASE_DATE\n\n" >| $TMP_FILE + echo -en "${{ github.event.release.body }}\nBased on Onfido OpenAPI spec " >> $TMP_FILE + + if [ -z $SPEC_RELEASE_VERSION ]; then + echo "up to commit [$SPEC_COMMIT_SHA](${SPEC_COMMIT_URL})." >> $TMP_FILE + else + echo "version [$SPEC_RELEASE_VERSION](${SPEC_RELEASE_URL})." >> $TMP_FILE + fi + + grep -v "^# Changelog" CHANGELOG.md >> $TMP_FILE + mv $TMP_FILE CHANGELOG.md + + git config user.name "GitHub Actions Bot" + git config user.email "<>" + git commit -m "Update CHANGELOG.md after library release" CHANGELOG.md + git push diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eacad5..156dcb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -## v4.0.0 11th Jun 2024 - -- Refresh library up to commit: [62dc554](https://github.com/onfido/onfido-openapi-spec/commit/62dc5541a4a51e8de313fc99fb3dec496033a23e) - ## v3.1.0 13th May 2024 (pre-release) - Include `nexus-staging-maven-plugin` only when necessary diff --git a/src/test/java/com/onfido/integration/ReportSchemasTest.java b/src/test/java/com/onfido/integration/ReportSchemasTest.java index dbaabf0..b371cf5 100644 --- a/src/test/java/com/onfido/integration/ReportSchemasTest.java +++ b/src/test/java/com/onfido/integration/ReportSchemasTest.java @@ -63,7 +63,6 @@ public void schemaOfFacialSimilarityPhotoReportIsValid() throws Exception { Assertions.assertEquals(check.getId(), facialSimilarityPhotoFullyAutoReport.getCheckId()); Assertions.assertNotNull(facialSimilarityPhotoFullyAutoReport.getBreakdown()); Assertions.assertNotNull(facialSimilarityPhotoFullyAutoReport.getResult()); - Assertions.assertNotNull( - facialSimilarityPhotoFullyAutoReport.getAdditionalProperties().get("properties")); + Assertions.assertNotNull(facialSimilarityPhotoFullyAutoReport.getProperties()); } }