Skip to content

Commit

Permalink
migrate to gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
cnorburn committed Jul 15, 2022
1 parent 5fb4267 commit 94c6ba1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 10 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Java CI with Gradle

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish package to GitHub Packages and Maven Central
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GPG_SIGNING_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
GPG_SIGNING_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


plugins {
id 'java-library'
id 'signing'
Expand All @@ -10,7 +8,7 @@ plugins {
apply plugin: 'java'

group = 'network.casper'
version='0.3.7'
version='0.3.10'
sourceCompatibility = 1.8
targetCompatibility = 1.8

Expand Down Expand Up @@ -63,7 +61,7 @@ jar {

task casperJar(type: Jar) {
archiveBaseName = 'casper-java-sdk'
archiveVersion = '0.3.6'
archiveVersion = '0.3.10'
manifest {
attributes 'Main-Class': 'com.casper.sdk.CasperSdk'
}
Expand All @@ -83,8 +81,8 @@ publishing {
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv('MAVEN_USERNAME')
password = System.getenv('MAVEN_PASSWORD')
username = System.getenv('OSSRH_USERNAME')
password = System.getenv('OSSRH_PASSWORD')
}
}
maven {
Expand Down Expand Up @@ -146,12 +144,14 @@ publishing {
}
}

jar {
archiveClassifier = ''
}

// Reference at https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
signing {
def signingKey = System.getenv('MAVEN_GPG_KEY') ?: findProperty('MAVEN_GPG_KEY')
def signingKeyPassword = System.getenv('MAVEN_GPG_PASSPHRASE') ?: findProperty('MAVEN_GPG_PASSPHRASE')


def signingKey = System.getenv('OSSRH_GPG_SECRET_KEY') ?: findProperty('OSSRH_GPG_SECRET_KEY')
def signingKeyPassword = System.getenv('OSSRH_GPG_SECRET_KEY_PASSWORD') ?: findProperty('OSSRH_GPG_SECRET_KEY_PASSWORD')

useInMemoryPgpKeys(signingKey, signingKeyPassword)
sign publishing.publications.mavenJava
Expand Down

0 comments on commit 94c6ba1

Please sign in to comment.