Skip to content

Commit

Permalink
Fix publishing issues (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto authored Jul 25, 2023
1 parent 69fdca4 commit f285022
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 33 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ jobs:
with:
name: libcpgo-amd64.dylib
path: cpg-language-go/src/main/resources/
- name: Download old dokka versions
run: |
# make sure the previousDocs folder exists
mkdir -p previousDocs && cd previousDocs
# retrieve the previous documentation folders for each published version (this also includes "main")
wget -O - https://github.com/Fraunhofer-AISEC/cpg/archive/gh-pages.tar.gz | tar -xz --strip=2 cpg-gh-pages/dokka || echo "No dokka directory present. Will continue as if nothing happened"
# in order to avoid duplicate mains, remove the "main" version from the previous versions
rm -rf main
- name: Build ${{ env.version }}
run: |
if [ "$SONAR_TOKEN" != "" ]
Expand Down Expand Up @@ -147,16 +139,32 @@ jobs:
with:
name: reports
path: reports.zip
- name: Publish
- name: Publish to Maven Central
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')
run: |
export ORG_GRADLE_PROJECT_signingKey=`echo ${{ secrets.GPG_PRIVATE_KEY }} | base64 -d`
./gradlew --no-daemon -Dorg.gradle.internal.publish.checksums.insecure=true --parallel -Pversion=$VERSION -PenableJavaFrontend=true -PenableCXXFrontend=true -PenableGoFrontend=true -PenablePythonFrontend=true -PenableLLVMFrontend=true -PenableTypeScriptFrontend=true publish
./gradlew --no-daemon -Dorg.gradle.internal.publish.checksums.insecure=true --parallel -Pversion=$VERSION -PenableJavaFrontend=true -PenableCXXFrontend=true -PenableGoFrontend=true -PenablePythonFrontend=true -PenableLLVMFrontend=true -PenableTypeScriptFrontend=true publishToSonatype closeSonatypeStagingRepository
env:
VERSION: ${{ env.version }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Download old dokka versions (version)
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')
run: |
# make sure the previousDocs folder exists
mkdir -p previousDocs && cd previousDocs
# retrieve the previous documentation folders for each published version (this also includes "main")
wget -O - https://github.com/Fraunhofer-AISEC/cpg/archive/gh-pages.tar.gz | tar -xz --strip=2 cpg-gh-pages/dokka || echo "No dokka directory present. Will continue as if nothing happened"
- name: Download old dokka versions (main)
if: github.ref == 'refs/heads/main'
run: |
# make sure the previousDocs folder exists
mkdir -p previousDocs && cd previousDocs
# retrieve the previous documentation folders for each published version (this also includes "main")
wget -O - https://github.com/Fraunhofer-AISEC/cpg/archive/gh-pages.tar.gz | tar -xz --strip=2 cpg-gh-pages/dokka || echo "No dokka directory present. Will continue as if nothing happened"
# in order to avoid duplicate mains, remove the "main" version from the previous versions
rm -rf main
- name: Build JavaDoc
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha') || github.ref == 'refs/heads/main'
run: |
Expand All @@ -169,6 +177,12 @@ jobs:
with:
folder: build/dokkaCustomMultiModuleOutput/${{ env.version }}
target-folder: dokka/${{ env.version }}
- name: Publish JavaDoc (version as main)
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/dokkaCustomMultiModuleOutput/${{ env.version }}
target-folder: dokka/main
- name: Publish JavaDoc (main)
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
15 changes: 15 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import java.io.ByteArrayOutputStream
plugins {
id("org.jetbrains.dokka")
id("org.sonarqube")
id("io.github.gradle-nexus.publish-plugin")
}

// this is needed for the plugins block
Expand Down Expand Up @@ -90,6 +91,20 @@ sonarqube {
}
}

/**
* Publishing to maven central
*/
nexusPublishing {
repositories {
sonatype() {
val mavenCentralUsername: String? by project
val mavenCentralPassword: String? by project

username.set(mavenCentralUsername)
password.set(mavenCentralPassword)
}
}
}


//
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ dependencies {
implementation(libs.dokka.gradle)
implementation(libs.sonarqube.gradle)
implementation(libs.spotless.gradle)
implementation(libs.nexus.publish.gradle)
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) // this is only there to be able to import 'LibrariesForLibs' in the convention plugins to access the version catalog in buildSrc
}
18 changes: 2 additions & 16 deletions buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {

`java-library`
jacoco
kotlin("jvm")
id("org.jetbrains.dokka")
signing
`maven-publish`
kotlin("jvm")
id("org.jetbrains.dokka")
}

group = "de.fraunhofer.aisec"
Expand Down Expand Up @@ -79,20 +79,6 @@ publishing {
}
}
}

repositories {
maven {
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")

credentials {
val mavenCentralUsername: String? by project
val mavenCentralPassword: String? by project

username = mavenCentralUsername
password = mavenCentralPassword
}
}
}
}

signing {
Expand Down
2 changes: 1 addition & 1 deletion cpg-language-typescript/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ publishing {

node {
download.set(findProperty("nodeDownload")?.toString()?.toBoolean() ?: false)
version.set("18.17.0")
version.set("16.20.1")
nodeProjectDir.set(file("${project.projectDir.resolve("src/main/nodejs")}"))
}

Expand Down
8 changes: 4 additions & 4 deletions cpg-language-typescript/src/main/nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cpg-language-typescript/src/main/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"start": "node src/parser.js"
},
"dependencies": {
"@types/node": "18.17.0",
"@types/node": "^16",
"typescript": "5.1.3"
},
"license": "Apache-2.0",
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ neo4j = "4.0.6"
log4j = "2.20.0"
sonarqube = "4.2.0.3129"
spotless = "6.20.0"
nexus-publish = "1.3.0"

[libraries]
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin"}
Expand Down Expand Up @@ -44,6 +45,7 @@ dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "
dokka-versioning= {module = "org.jetbrains.dokka:versioning-plugin", version = "1.8.10"}
sonarqube-gradle = { module = "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin", version.ref = "sonarqube" }
spotless-gradle = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" }
nexus-publish-gradle = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "nexus-publish" }

[bundles]
log4j = ["log4j-impl", "log4j-core"]
Expand Down
1 change: 0 additions & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ jdk:
before_install:
- mkdir -p ~/go
- wget -q https://go.dev/dl/go1.20.4.linux-amd64.tar.gz && tar -C ~ -xzf go1.20.4.linux-amd64.tar.gz
- ls -l ~/go
install:
- export PATH="$PATH:$HOME/go/bin"
- cp gradle.properties.example gradle.properties
Expand Down

0 comments on commit f285022

Please sign in to comment.