Skip to content

Commit 63d354b

Browse files
committed
ci: wire up GitHub Actions build + JFrog publish via shared reusable workflow
Adds .github/workflows/build-publish.yml (~30 lines) that calls NrgXnat/xnat-ci-workflows/.github/workflows/gradle-build-publish.yml@v1 for the build → JFrog publish path. No Docker image yet (plugin distribution image flow is deferred per project plan). Trigger branches: main, develop, releases/*, github-build (github-build is the temporary validation branch, to be removed once the pipeline is verified on this repo) workflow_dispatch with one boolean input (publish_jfrog) lets manual runs cherry-pick whether to actually publish. build.gradle change: add `credentials { ... }` to the XNAT_Artifactory maven repository so CI's ORG_GRADLE_PROJECT_artifactoryUser/Token env vars (sourced from org-level GitHub Secrets XNAT_ARTIFACTORY_USER/TOKEN) authenticate the gradle publish. Local devs can put artifactoryUser/Token in ~/.gradle/gradle.properties for manual publishes the same way. Java version is pinned to 8 here because this branch line (XNAT 1.9.2) still compiles with sourceCompatibility = VERSION_1_8. The java-upgrade / *java21-rc branches will need their own caller with java-version: '21' when those lines get wired up. Verified the reusable workflow's version-detection step picks up `version "0.9.0-SNAPSHOT"` from build.gradle (no gradle.properties needed) — see NrgXnat/xnat-ci-workflows commit 40cc407.
1 parent 9bcb050 commit 63d354b

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Publish
2+
3+
# Thin caller around the shared reusable workflow in
4+
# NrgXnat/xnat-ci-workflows. All build/publish orchestration lives there;
5+
# this file only defines our triggers and the project-specific inputs
6+
# (java version, jar layout — plugin doesn't ship a Docker image yet).
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- develop
13+
- 'releases/*'
14+
- github-build # for pipeline testing; remove once verified
15+
workflow_dispatch:
16+
inputs:
17+
publish_jfrog:
18+
description: 'Publish jar to JFrog Artifactory (nrgxnat)'
19+
type: boolean
20+
default: false
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
build-publish:
27+
uses: NrgXnat/xnat-ci-workflows/.github/workflows/gradle-build-publish.yml@v1
28+
with:
29+
# build.gradle still pins sourceCompatibility = VERSION_1_8 on the
30+
# develop / main branches (XNAT 1.9.2 line). The java-upgrade /
31+
# *java21-rc branches will need their own caller with
32+
# java-version: '21'.
33+
java-version: '8'
34+
artifact-glob: 'build/libs/*.jar'
35+
# No Docker image for plugins yet (per project plan).
36+
publish-jfrog: ${{ github.event_name == 'push' || inputs.publish_jfrog }}
37+
publish-ghcr: false
38+
39+
# secrets: inherit passes XNAT_ARTIFACTORY_USER/TOKEN (org-level)
40+
# through to the reusable workflow.
41+
secrets: inherit

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ publishing {
191191
} else {
192192
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
193193
}
194+
// CI injects ORG_GRADLE_PROJECT_artifactoryUser/Token env vars.
195+
// Local devs can set artifactoryUser/Token in ~/.gradle/gradle.properties.
196+
credentials {
197+
username = (project.findProperty('artifactoryUser') ?: System.getenv('ARTIFACTORY_USER')) ?: ''
198+
password = (project.findProperty('artifactoryToken') ?: System.getenv('ARTIFACTORY_TOKEN')) ?: ''
199+
}
194200
}
195201
}
196202
}

0 commit comments

Comments
 (0)