Skip to content

Commit d8395c2

Browse files
committed
clean up github actions, more deployment into build.gradle
1 parent d55852d commit d8395c2

File tree

5 files changed

+100
-155
lines changed

5 files changed

+100
-155
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/javadoc.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/nightlydeploy.yml

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Nightly Deployer of Weekly Builds
1+
name: Weekly Builds of KeY
22

33
on:
44
workflow_dispatch:
@@ -9,9 +9,12 @@ permissions:
99
contents: write
1010
id-token: write
1111

12+
env:
13+
JAVA_VERSION: 21
14+
1215

1316
jobs:
14-
deploy:
17+
build:
1518
runs-on: ubuntu-latest
1619
steps:
1720
# weigl: Should produce fancier release notes, but needs some configuration
@@ -24,17 +27,57 @@ jobs:
2427
# fetchReviewers: true
2528

2629
- uses: actions/checkout@v4
30+
2731
- name: Set up JDK 21
2832
uses: actions/setup-java@v4
2933
with:
30-
java-version: 21
34+
java-version: ${{ env.JAVA_VERSION }}
3135
distribution: 'temurin'
36+
cache: 'gradle'
3237

3338
- name: Setup Gradle
3439
uses: gradle/actions/setup-gradle@v4
40+
3541
- name: Build with Gradle
3642
run: ./gradlew --parallel assemble
3743

44+
doc:
45+
needs: [build]
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Set up JDK 21
50+
uses: actions/setup-java@v4
51+
with:
52+
java-version: ${{ env.JAVA_VERSION }}
53+
distribution: 'corretto'
54+
cache: 'gradle'
55+
56+
- name: Setup Gradle
57+
uses: gradle/actions/setup-gradle@v4
58+
59+
- name: Build Documentation with Gradle
60+
run: ./gradlew alldoc
61+
62+
- name: Package
63+
run: tar cvf key-javadoc.tar.xz build/docs/javadoc
64+
65+
deploy:
66+
needs: [build, doc]
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Upload Javadoc
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: javadoc
73+
path: "javadoc.tar.xz"
74+
75+
- name: Upload ShadowJar
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: shadowjars
79+
path: "*/build/libs/*-exe.jar"
80+
3881
- name: Delete previous nightly release
3982
continue-on-error: true
4083
env:
@@ -50,3 +93,25 @@ jobs:
5093
gh release create --generate-notes --title "Nightly Release" \
5194
--prerelease --notes-start-tag KEY-2.12.3 \
5295
nightly key.ui/build/libs/key-*-exe.jar
96+
97+
deploy-maven:
98+
needs: [ build, doc ]
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@v4
102+
- name: Set up JDK 21
103+
uses: actions/setup-java@v4
104+
with:
105+
java-version: ${{ env.JAVA_VERSION }}
106+
distribution: 'temurin'
107+
cache: 'gradle'
108+
109+
- name: Setup Gradle
110+
uses: gradle/actions/setup-gradle@v4
111+
112+
- name: Upload to SNAPSHOT repository
113+
run: ./gradlew publishToCentral
114+
env:
115+
BUILD_NUMBER: "SNAPSHOT"
116+
ossrhUsername: ${{ secrets.MAVEN_CENTRAL_USER }}
117+
ossrhPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

.github/workflows/sonarqube.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

build.gradle

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ subprojects {
108108
}
109109

110110
tasks.withType(Test).configureEach {//Configure all tests
111-
112111
def examplesDir = rootProject.layout.projectDirectory.dir("key.ui/examples").getAsFile()
113112
def runAllProofsReportDir = layout.buildDirectory.dir("report/runallproves/").get().getAsFile()
114113
systemProperty "test-resources", "src/test/resources"
@@ -322,9 +321,29 @@ subprojects {
322321
}
323322
repositories {
324323
maven {
325-
name = "keylocal"
324+
name = "LOCAL"
326325
url= uri("$rootDir/local")
327326
}
327+
328+
maven { // deployment to git.key-project.org/key-public/key
329+
name = "KEYLAB"
330+
url = uri("https://git.key-project.org/api/v4/projects/35/packages/maven")
331+
credentials(HttpHeaderCredentials) {
332+
// Gitlab supports three kinds of token.
333+
if (System.getenv("TOKEN") != null) {
334+
// Support for user token
335+
name = 'Private-Token'
336+
value = envOrPropertyValue("TOKEN")
337+
} else {
338+
// Support for Gitlab CI
339+
name = 'Job-Token'
340+
value = envOrPropertyValue("CI_JOB_TOKEN")
341+
}
342+
}
343+
authentication {
344+
header(HttpHeaderAuthentication)
345+
}
346+
}
328347
}
329348
}
330349

@@ -361,34 +380,8 @@ nexusPublishing {
361380
* You can test signing with `gradle sign`, and publish with `gradle publish`.
362381
* https://central.sonatype.org/publish/publish-guide/
363382
*/
364-
username = project.properties.getOrDefault("ossrhUsername", "")
365-
password = project.properties.getOrDefault("ossrhPassword", "")
366-
}
367-
}
368-
}
369-
370-
maven { // deployment to git.key-project.org
371-
name = "GitlabPackages"
372-
url "https://git.key-project.org/api/v4/projects/35/packages/maven"
373-
credentials(HttpHeaderCredentials) {
374-
if (System.getenv("TOKEN") != null) {
375-
name = 'Private-Token'
376-
value = System.getenv("TOKEN")
377-
} else {
378-
name = 'Job-Token'
379-
value = System.getenv("CI_JOB_TOKEN")
380-
}
381-
}
382-
authentication {
383-
header(HttpHeaderAuthentication)
384-
}
385-
}
386-
}
387-
}
388-
389-
signing {
390-
useGpgCmd() // works better than the Java implementation, which requires PGP keyrings.
391-
sign publishing.publications.mavenJava
383+
username = envOrPropertyValue("ossrhUsername")
384+
password = envOrPropertyValue("ossrhPassword")
392385
}
393386
}
394387
}
@@ -444,3 +437,12 @@ if (jacocoEnabled.toBoolean()) {
444437
project.logger.lifecycle("Jacoco enabled. Test performance will be slower.")
445438
apply from: rootProject.file("scripts/jacocokey.gradle")
446439
}
440+
441+
442+
def envOrPropertyValue(String key) {
443+
if(key in System.getenv()) {
444+
return System.getenv(key)
445+
}else{
446+
return project.properties.getOrDefault(key, "$key-not-found")
447+
}
448+
}

0 commit comments

Comments
 (0)