Skip to content

Commit

Permalink
Jar signing, II Maven publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
VDeltaGabriel committed Aug 16, 2024
1 parent 47a0a19 commit 009ac4d
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 8 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Project

on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'

jobs:
build:
runs-on: ubuntu-latest
name: Create a Dev Build
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.OPTIMIZATION_TOKEN }}
JAVA_VERSION: 8
SIGN_KEYSTORE: ~/keystore.jks
SIGN_ALIAS: ${{secrets.SIGN_ALIAS}}
SIGN_STOREPASS: ${{secrets.SIGN_STOREPASS}}
SIGN_KEYPASS: ${{secrets.SIGN_STOREPASS}}
SIGN_TIMESTAMP: ${{secrets.SIGN_TIMESTAMP}}
iiMavenReleasesUsername: ${{secrets.IIMAVENRELEASESUSERNAME}}
iiMavenReleasesPassword: ${{secrets.IIMAVENRELEASESPASSWORD}}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8

- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
with:
fileName: '~/keystore.jks'
encodedString: ${{ secrets.SIGN_KEYSTORE }}

- name: Execute Gradle publish
run: chmod +x gradlew ; ./gradlew publish --scan
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ bin/
.vscode/

### Mac OS ###
.DS_Store
.DS_Store

cert/*

custom.gradle
46 changes: 39 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,54 @@ dependencies {
implementation 'com.google.testing.compile:compile-testing:0.21.0'
}

def customGradle = rootProject.file('custom.gradle')
if (customGradle.exists()) {
apply from: customGradle
}

tasks.register('signJar') {
group 'signing'

outputs.upToDateWhen {false}

doLast {
def signdir = new File("$buildDir/libs")
signdir.mkdirs()
ant.signjar(
destDir: "${signdir.absolutePath}",
jar: "${signdir.absolutePath}/*.jar",
alias: project.ksalias ?: System.getenv("SIGN_ALIAS"),
storetype: "jks",
keystore: project.keystore ?: System.getenv("SIGN_KEYSTORE"),
storepass: project.storepass ?: System.getenv("SIGN_STOREPASS"),
keypass: project.keypass ?: System.getenv("SIGN_KEYPASS"),
verbose: true,
preservelastmodified: "true",
tsaurl: project.timestamp_url ?: System.getenv("SIGN_TIMESTAMP")
)
}
}

tasks.build.finalizedBy() {
signJar
}

test {
useJUnitPlatform()
}

publishing {
repositories {
maven {
name = "GitHub"
url = "https://maven.pkg.github.com/Team-Immersive-Intelligence/ModworksProcessor"

name "iiMavenReleases"
credentials {
// username = System.getenv("MAVEN_USERNAME")
username = project.findProperty("mvn_user") ?: System.getenv("mvn_user")
password = project.findProperty("mvn_token") ?: System.getenv("mvn_token")
println "GitHubPackages build.gradle\n\tusername=$username\n\ttoken=$password"
username = project.iiMavenReleasesUsername ?: System.getenv("iiMavenReleasesUsername")
password = project.iiMavenReleasesPassword ?: System.getenv("iiMavenReleasesPassword")
}
authentication {
basic(BasicAuthentication)
}
url "https://maven.iiteam.net/releases"
}
}
publications {
Expand Down
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
iiMavenReleasesUsername=
iiMavenReleasesPassword=
timestamp_url=
ksalias=
keystore=
storepass=
keypass=

0 comments on commit 009ac4d

Please sign in to comment.