diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cacc538a..07b52743 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,5 @@ name: Release -env: - MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - on: release: types: [ published ] @@ -16,20 +10,57 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Import GPG key + run: | + echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | gpg --batch --import + echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf + + - name: Install xmllint + run: sudo apt-get update && sudo apt-get install -y libxml2-utils + + - name: Extract version from pom.xml + id: get_version + run: | + version=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" auto-generated-sdk/pom.xml) + echo "version=$version" >> $GITHUB_OUTPUT + if [[ "$version" == *SNAPSHOT* ]]; then + echo "is_snapshot=true" >> $GITHUB_OUTPUT + else + echo "is_snapshot=false" >> $GITHUB_OUTPUT + fi + + - name: Set up JDK for snapshot repository + if: steps.get_version.outputs.is_snapshot == 'true' + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + server-id: central-portal-snapshots + server-username: MAVEN_PORTAL_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - - name: Set up JDK - uses: actions/setup-java@v1 + - name: Set up JDK for release repository + if: steps.get_version.outputs.is_snapshot == 'false' + uses: actions/setup-java@v4 with: - java-version: 1.8 - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ env.MAVEN_GPG_PRIVATE_KEY }} + java-version: '8' + distribution: 'temurin' + server-id: central + server-username: MAVEN_PORTAL_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} gpg-passphrase: MAVEN_GPG_PASSPHRASE - - - name: Build - run: mvn -B package --file auto-generated-sdk/pom.xml - + + - name: Build with Maven + run: mvn -B package --file auto-generated-sdk/pom.xml + - name: Publish to Apache Maven Central run: cd auto-generated-sdk && mvn -Psign-artifacts verify deploy + env: + MAVEN_PORTAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} \ No newline at end of file diff --git a/auto-generated-sdk/pom.xml b/auto-generated-sdk/pom.xml index 5382cb54..700c8f58 100644 --- a/auto-generated-sdk/pom.xml +++ b/auto-generated-sdk/pom.xml @@ -5,14 +5,28 @@ engines-sdk jar engines-sdk - 6.2.0 + 6.2.1 https://github.com/factset/analyticsapi-engines-java-sdk SDK for FactSet Analytics Engines API + + Central Portal Snapshots + central-portal-snapshots + https://central.sonatype.com/repository/maven-snapshots/ + + false + + + true + + - ossrh - Central Repository OSSRH - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + Central Portal Releases + central + https://central.sonatype.com + + true + @@ -91,6 +105,15 @@ + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + ${project.groupId}-${project.artifactId}-${project.version} + + @@ -204,7 +227,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.8 sign-artifacts @@ -212,7 +235,7 @@ sign - + --pinentry-mode @@ -222,6 +245,14 @@ + + org.sonatype.central + central-publishing-maven-plugin + + central + validated + + diff --git a/tests/pom.xml b/tests/pom.xml index 44007459..7ee3a4c4 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -3,7 +3,7 @@ com.factset tests - 0.0.1 + 0.0.2 @@ -116,7 +116,7 @@ system - ${project.basedir}/../auto-generated-sdk/target/engines-sdk-6.2.0.jar + ${project.basedir}/../auto-generated-sdk/target/engines-sdk-6.2.1.jar com.factset.analyticsapi engines-sdk ${engines-sdk-version} @@ -142,7 +142,7 @@ 4.13.1 3.25.1 1.6.0 - 6.2.0 + 6.2.1 4.0.1