-
Notifications
You must be signed in to change notification settings - Fork 40
150 lines (130 loc) · 4.46 KB
/
java-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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