diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..66d6773 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Publish to Maven Central + +on: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - id: install-secret-key + name: Install gpg secret key + run: | + cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import + - name: Deploy + run: | + mvn -P gpg_verify \ + --no-transfer-progress \ + --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \ + --file pom.xml -s release/m2-settings.xml verify deploy + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} \ No newline at end of file diff --git a/pom.xml b/pom.xml index a76a18c..702bd1f 100644 --- a/pom.xml +++ b/pom.xml @@ -106,10 +106,48 @@ + + gpg_verify + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + --pinentry-mode + loopback + + + + + sign-artifacts + verify + + sign + + + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + true + + org.apache.maven.plugins maven-compiler-plugin @@ -169,11 +207,10 @@ - - bintray-clevertap-Maven - clevertap-Maven - https://api.bintray.com/maven/clevertap/Maven/apns-http2/;publish=1 - + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + diff --git a/release/m2-settings.xml b/release/m2-settings.xml new file mode 100644 index 0000000..ddd2ad7 --- /dev/null +++ b/release/m2-settings.xml @@ -0,0 +1,9 @@ + + + + ossrh + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + \ No newline at end of file