Skip to content

Commit b2ee825

Browse files
committed
Publishing workflow
1 parent ea70e51 commit b2ee825

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
3+
4+
name: Gradle Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
env:
17+
PLUGIN_NAME: dicom-edit-routing
18+
PLUGIN_DIR: ${{ github.workspace }}
19+
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
20+
GRADLE_USER_HOME: ${{ github.workspace }}/.gradle
21+
steps:
22+
- uses: actions/checkout@v5
23+
24+
- name: Set up JDK 11
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '11'
28+
distribution: 'temurin'
29+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
30+
settings-path: ${{ github.workspace }} # location for the settings.xml file
31+
cache: gradle
32+
33+
- name: Print Gradle version
34+
run: ./gradlew --version
35+
36+
- name: Build plugin
37+
run: |
38+
echo "Building plugin ${{ env.PLUGIN_NAME }}, located at ${{ env.PLUGIN_DIR }}. Using Gradle user home at ${{ env.GRADLE_USER_HOME }}"
39+
./gradlew -p ${{ env.PLUGIN_DIR }} clean build
40+
41+
- name: Publish to GitHub Packages
42+
run: ./gradlew publish
43+
env:
44+
GITHUB_ACTOR: ${{ github.actor }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ plugins {
88
id "org.nrg.xnat.build.xnat-data-builder" version "1.8.10"
99
id "me.qoomon.git-versioning" version "6.4.2"
1010
id "jacoco"
11+
id "maven-publish"
1112
}
1213

1314
ext {
@@ -172,4 +173,26 @@ jacocoTestReport {
172173
}
173174
}
174175

175-
compileJava.dependsOn project.tasks["xnatDataBuilder"]
176+
compileJava.dependsOn project.tasks["xnatDataBuilder"]
177+
178+
publishing {
179+
publications {
180+
mavenJava(MavenPublication) {
181+
from components.java
182+
artifact jar
183+
groupId = project.group
184+
artifactId = rootProject.name
185+
version = project.version
186+
}
187+
}
188+
repositories {
189+
maven {
190+
name = "GithubPackages"
191+
url = uri("https://maven.pkg.github.com/ParisBrainInstitute/DicomEdit-Routing")
192+
credentials {
193+
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
194+
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
195+
}
196+
}
197+
}
198+
}

0 commit comments

Comments
 (0)