Skip to content

Commit 9cac189

Browse files
committed
clean up github actions, more deployment into build.gradle
1 parent 3a0ca4e commit 9cac189

File tree

5 files changed

+99
-155
lines changed

5 files changed

+99
-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: 67 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
@@ -27,14 +30,53 @@ jobs:
2730
- name: Set up JDK 21
2831
uses: actions/setup-java@v5
2932
with:
30-
java-version: 21
33+
java-version: ${{ env.JAVA_VERSION }}
3134
distribution: 'temurin'
35+
cache: 'gradle'
3236

3337
- name: Setup Gradle
3438
uses: gradle/actions/setup-gradle@v4
39+
3540
- name: Build with Gradle
3641
run: ./gradlew --parallel assemble
3742

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

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

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

0 commit comments

Comments
 (0)