Skip to content

Commit

Permalink
Trying to publish to GH packages (#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto authored Jan 21, 2025
1 parent f4d35c5 commit ba5c0c5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
jobs:
build:
runs-on: [self-hosted, Linux, ARM64]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- run: |
Expand All @@ -44,8 +47,8 @@ jobs:
export VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
if [[ $VERSION != v* ]]
then
export VERSION=""
echo "Building version-less (main or feature branch)"
export VERSION="${VERSION}-SNAPSHOT"
echo "Building as ${VERSION}"
else
# make version more Java-friendly by dropping the 'v'
export VERSION=${VERSION:1:${#VERSION}}
Expand Down Expand Up @@ -91,6 +94,13 @@ jobs:
with:
name: reports
path: reports.zip
- name: Publish to GitHub Packages
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'publish-to-github-packages')
run: |
./gradlew --parallel -Pversion=$VERSION publishAllPublicationsToGitHubPackagesRepository
env:
VERSION: ${{ env.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Maven Central
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')
run: |
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code Property Graph
[![Actions Status](https://github.com/Fraunhofer-AISEC/cpg/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/Fraunhofer-AISEC/cpg/actions)
[![codecov](https://codecov.io/gh/Fraunhofer-AISEC/cpg/graph/badge.svg?token=XBXZZOQIID)](https://codecov.io/gh/Fraunhofer-AISEC/cpg) [![](https://jitpack.io/v/Fraunhofer-AISEC/cpg.svg)](https://jitpack.io/#Fraunhofer-AISEC/cpg)
[![codecov](https://codecov.io/gh/Fraunhofer-AISEC/cpg/graph/badge.svg?token=XBXZZOQIID)](https://codecov.io/gh/Fraunhofer-AISEC/cpg)

A simple library to extract a *code property graph* out of source code. It has support for multiple passes that can extend the analysis after the graph is constructed. It currently supports C/C++ (C17), Java (Java 13) and has experimental support for Golang, Python and TypeScript. Furthermore, it has support for the [LLVM IR](http://llvm.org/docs/LangRef.html) and thus, theoretically support for all languages that compile using LLVM.

Expand Down Expand Up @@ -76,7 +76,9 @@ Beware, that the `cpg` module includes all optional features and might potential

#### Development Builds

A published artifact of every commit can be requested through [JitPack](https://jitpack.io/#Fraunhofer-AISEC/cpg). This is especially useful, if your external project makes use of a specific feature that is not yet merged in yet or not published as a version yet. Please follow the instructions on the JitPack page. Please be aware, that similar to release builds, the CDT repository needs to be added as well (see above).
For all builds on the `main` branch, an artefact is published in the [GitHub Packages](https://github.com/orgs/Fraunhofer-AISEC/packages?repo_name=cpg) under the version `main-SNAPSHOT`. Additionally, selected PRs that have the `publish-to-github-packages` label will also be published there. This is useful if an important feature is not yet in main, but you want to test it. The version refers to the PR number, e.g. `1954-SNAPSHOT`.

To use the GitHub Gradle Registry, please refer to https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#using-a-published-package

### On Command Line

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fun generateDokkaWithVersionTag(dokkaMultiModuleTask: org.jetbrains.dokka.gradle
*/
nexusPublishing {
repositories {
sonatype() {
sonatype {
val mavenCentralUsername: String? by project
val mavenCentralPassword: String? by project

Expand Down
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/cpg.common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ publishing {
}
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Fraunhofer-AISEC/cpg")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

signing {
Expand Down
2 changes: 1 addition & 1 deletion codyze-compliance/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ publishing {
publications {
named<MavenPublication>("codyze-compliance") {
pom {
artifactId = "codyze"
artifactId = "codyze-compliance"
name.set("Codyze - Compliance Module")
description.set("The compliance module of Codyze")
}
Expand Down
6 changes: 0 additions & 6 deletions jitpack.yml

This file was deleted.

0 comments on commit ba5c0c5

Please sign in to comment.