diff --git a/.github/workflows/publish-releases.yml b/.github/workflows/publish-releases.yml new file mode 100644 index 0000000..7b864ed --- /dev/null +++ b/.github/workflows/publish-releases.yml @@ -0,0 +1,66 @@ +name: Publish Releases + +on: + push: + tags: ["**"] + +jobs: + # Run Gradle Wrapper Validation to verify the wrapper's checksum + gradle-validation: + name: Gradle Wrapper + runs-on: ubuntu-latest + if: github.repository_owner == 'taymyr' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was + fetch-depth: 0 + + - name: Gradle Wrapper Validation + uses: gradle/wrapper-validation-action@v1 + + publish-artifacts: + name: Publish Artifacts for Scala ${{ matrix.scala }} + runs-on: ubuntu-latest + if: github.repository_owner == 'taymyr' + needs: gradle-validation + strategy: + matrix: + include: + - scala: "2.11" + lagom: "1.4.15" + - scala: "2.12" + lagom: "1.5.5" + - scala: "2.13" + lagom: "1.6.4" + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was + fetch-depth: 0 + - run: git fetch --tags --force origin # WA: https://github.com/actions/checkout/issues/882 + + - uses: actions/setup-java@v3 + with: + distribution: 'liberica' + java-version: '8' + check-latest: true + cache: 'gradle' + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Publish Releases + run: >- + ./gradlew --no-daemon version publishToSonatype closeAndReleaseSonatypeStagingRepository -x test + -PscalaBinaryVersion=${{ matrix.scala }} -PlagomVersion=${{ matrix.lagom }} + -Psigning.gnupg.keyName=$GPG_KEY_ID + -Psigning.gnupg.passphrase="$GPG_PASSPHRASE" + -PsonatypeUsername="$OSSRH_USERNAME" + -PsonatypePassword="$OSSRH_TOKEN" + env: + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} diff --git a/.github/workflows/publish-snapshots.yml b/.github/workflows/publish-snapshots.yml new file mode 100644 index 0000000..9e784b3 --- /dev/null +++ b/.github/workflows/publish-snapshots.yml @@ -0,0 +1,66 @@ +name: Publish Snapshots + +on: + push: + branches: + - master + +jobs: + # Run Gradle Wrapper Validation to verify the wrapper's checksum + gradle-validation: + name: Gradle Wrapper + runs-on: ubuntu-latest + if: github.repository_owner == 'taymyr' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was + fetch-depth: 0 + + - name: Gradle Wrapper Validation + uses: gradle/wrapper-validation-action@v1 + + publish-artifacts: + name: Publish Artifacts for Scala ${{ matrix.scala }} + runs-on: ubuntu-latest + if: github.repository_owner == 'taymyr' + needs: gradle-validation + strategy: + matrix: + include: + - scala: "2.11" + lagom: "1.4.15" + - scala: "2.12" + lagom: "1.5.5" + - scala: "2.13" + lagom: "1.6.4" + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was + fetch-depth: 0 + + - uses: actions/setup-java@v3 + with: + distribution: 'liberica' + java-version: '8' + check-latest: true + cache: 'gradle' + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Publish Snapshots + run: >- + ./gradlew --no-daemon version publishToSonatype -x test + -PscalaBinaryVersion=${{ matrix.scala }} -PlagomVersion=${{ matrix.lagom }} + -Psigning.gnupg.keyName=$GPG_KEY_ID + -Psigning.gnupg.passphrase="$GPG_PASSPHRASE" + -PsonatypeUsername="$OSSRH_USERNAME" + -PsonatypePassword="$OSSRH_TOKEN" + env: + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b0fc1ab..0000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -language: java - -# Only build non-pushes (so PRs, API requests & cron jobs) OR tags OR forks OR main branch builds -# https://docs.travis-ci.com/user/conditional-builds-stages-jobs/ -if: type != push OR tag IS present OR fork OR branch = master - -env: - - SCALA_VERSION=2.11 LAGOM_VERSION=1.4.15 - - SCALA_VERSION=2.12 LAGOM_VERSION=1.5.5 - - SCALA_VERSION=2.13 LAGOM_VERSION=1.6.2 - -jdk: - - openjdk8 - -services: - - docker - -matrix: - fast_finish: true - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - -script: - - ./gradlew clean check -PlagomVersion=$LAGOM_VERSION -PscalaBinaryVersion=$SCALA_VERSION - -after_success: - - bash <(curl -s https://codecov.io/bash) - -before_deploy: - - echo $GPG_SECRET_KEYS | base64 --decode > $HOME/.gnupg/taymyr.gpg - -deploy: - # Deploy releases - - provider: script - script: bin/publish-release - skip_cleanup: true - on: - tags: true - # Deploy snapshots - - provider: script - script: bin/publish-snapshots - skip_cleanup: true - on: - branch: master - tags: false - -notifications: - webhooks: - urls: - - "https://webhooks.gitter.im/e/9e04688b0ae124f5a047" - - "https://webhooks.gitter.im/e/869b1a645dc46645e619" - on_success: change - on_failure: always - on_start: never \ No newline at end of file diff --git a/bin/publish-release b/bin/publish-release deleted file mode 100755 index f345107..0000000 --- a/bin/publish-release +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/scriptLib" - -VERSION=$(version) - -printMessage "PUBLISH RELEASE $VERSION FOR SCALA $SCALA_VERSION" - -if [[ $VERSION =~ ^.*-SNAPSHOT$ ]]; then - printMessage "RELEASE WOULD NOT BE PUBLISHED: is not a stable version" -else - ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -x test \ - -Psigning.keyId=$GPG_KEY_NAME \ - -Psigning.password="$GPG_PASSPHRASE" \ - -Psigning.secretKeyRingFile=$HOME/.gnupg/taymyr.gpg \ - -PsonatypeUsername=$OSS_USERNAME \ - -PsonatypePassword="$OSS_PASSWORD" \ - -PscalaBinaryVersion=$SCALA_VERSION \ - -PlagomVersion=$LAGOM_VERSION - printMessage "RELEASE $VERSION PUBLISHED FOR SCALA $SCALA_VERSION" -fi - diff --git a/bin/publish-snapshots b/bin/publish-snapshots deleted file mode 100755 index 6609d10..0000000 --- a/bin/publish-snapshots +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/scriptLib" - -VERSION=$(version) - -printMessage "PUBLISH SNAPSHOT $VERSION FOR SCALA $SCALA_VERSION" - -if [[ $VERSION =~ ^.*-SNAPSHOT$ ]]; then - ./gradlew publishToSonatype -x test \ - -Psigning.keyId=$GPG_KEY_NAME \ - -Psigning.password="$GPG_PASSPHRASE" \ - -Psigning.secretKeyRingFile=$HOME/.gnupg/taymyr.gpg \ - -PsonatypeUsername=$OSS_USERNAME \ - -PsonatypePassword="$OSS_PASSWORD" \ - -PscalaBinaryVersion=$SCALA_VERSION \ - -PlagomVersion=$LAGOM_VERSION - printMessage "SNAPSHOT $VERSION PUBLISHED FOR SCALA $SCALA_VERSION" -else - printMessage "SNAPSHOT WOULD NOT BE PUBLISHED: is not a snapshot version" -fi - diff --git a/bin/scriptLib b/bin/scriptLib deleted file mode 100755 index 582de7c..0000000 --- a/bin/scriptLib +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -printMessage() { - echo "[info]" - echo "[info] ---- $1" - echo "[info]" -} - -version() { - grep 'projectVersion' gradle.properties | cut -d'=' -f2 -} \ No newline at end of file diff --git a/java/build.gradle.kts b/java/build.gradle.kts index d5ae2c6..633937c 100644 --- a/java/build.gradle.kts +++ b/java/build.gradle.kts @@ -152,6 +152,7 @@ publishing { } signing { + useGpgCmd() isRequired = isReleaseVersion sign(publishing.publications["maven"]) }