Skip to content

Test Publish Dummy Package to Maven Central #1

Test Publish Dummy Package to Maven Central

Test Publish Dummy Package to Maven Central #1

Workflow file for this run

name: Test Publish Dummy Package to Maven Central
on:
workflow_dispatch:
jobs:
publish-dummy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_JAVA_PUBLISHING }}
passphrase: ${{ secrets.GPG_PASSPHRASE_JAVA_PUBLISHING }}
- name: Create dummy project and initialize Gradle
run: |
mkdir -p src/main/java/org/rust/verkle
echo "package org.rust.verkle;
/**
* DummyClass is a simple class for testing the build and deployment process.
*/
public class DummyClass {
/**
* Main method that prints a hello message.
*
* @param args command line arguments
*/
public static void main(String[] args) {
System.out.println(\"Hello from Verkle trie\");
}
}" > src/main/java/org/rust/verkle/DummyClass.java
echo "plugins {
id 'java-library'
id 'maven-publish'
id 'org.jreleaser' version '1.12.0'
}
group = 'io.github.kevaundray.rust-verkle-poc'
version = '0.0.5'
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
maven(MavenPublication) {
from components.java
pom {
name = 'Verkle Trie cryptography'
description = 'A library for verkle trie'
url = 'https://github.com/crate-crypto/rust-verkle'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'kevthedev'
name = 'Kev Wed'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/crate-crypto/rust-verkle.git'
developerConnection = 'scm:git:ssh://github.com:crate-crypto/rust-verkle.git'
url = 'https://github.com/crate-crypto/rust-verkle'
}
}
}
}
repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
}
}
}
jreleaser {
signing {
active = 'ALWAYS'
armored = true
}
deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository('build/staging-deploy')
}
}
}
}
}
// TODO: Find out why jreleaser does not just create this
// Directory.
tasks.register('createJReleaserOutputDir') {
doLast {
mkdir 'build/jreleaser'
}
}
tasks.named('jreleaserFullRelease') {
dependsOn 'createJReleaserOutputDir'
}" > build.gradle
# Initialize Gradle wrapper
gradle wrapper
- name: Publish dummy package to Maven Central
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_TOKEN_USERNAME }}
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.CENTRAL_PORTAL_TOKEN_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE_JAVA_PUBLISHING }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY_JAVA_PUBLISHING }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY_JAVA_PUBLISHING }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean createJReleaserOutputDir jreleaserConfig build publish jreleaserFullRelease --stacktrace --info
- name: JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-logs
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties