Skip to content

Commit acc6eae

Browse files
peterkirchrisrueger
authored andcommitted
limit sonatype snapshot deployments
Signed-off-by: Peter Kirschner <peter@klib.io>
1 parent e2706e1 commit acc6eae

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/scripts/ci-build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ fi
1919
# build
2020
./gradlew --no-daemon --version
2121
./mvnw --version
22-
./gradlew --no-daemon -Dmaven.repo.local=dist/m2 --continue :build "$@"
22+
./gradlew \
23+
--no-daemon \
24+
-Dmaven.repo.local=dist/m2 \
25+
-Dbnd.sonatype.release.description=${GITHUB_JOB}_${GITHUB_RUN_NUMBER} \
26+
--continue \
27+
:build "$@"
2328
./gradlew --no-daemon -Dmaven.repo.local=dist/m2 --continue :gradle-plugins:build
2429
./mvnw -Dmaven.repo.local=dist/m2 --batch-mode --no-transfer-progress install

.github/workflows/cibuild.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ jobs:
121121
id: publish
122122
if: ${{ matrix.canonical }}
123123
run: |
124+
env | sort
124125
./.github/scripts/ci-publish.sh
125126
env:
126127
CANONICAL: ${{ matrix.canonical }}

biz.aQute.repository/src/aQute/maven/provider/Releaser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ private void uploadToPortal(File deploymentBundle) throws Exception {
359359
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss.SSS");
360360
String msg = String.format("uploaded from bnd on %s", LocalDateTime.now()
361361
.format(dtf));
362-
String encodedMsg = URLEncoder.encode(msg, StandardCharsets.UTF_8)
362+
String sonatypeDesc = System.getProperty("bnd.sonatype.release.description", msg);
363+
String encodedMsg = URLEncoder.encode(sonatypeDesc, StandardCharsets.UTF_8)
363364
.replace("+", "%20");
364365
String paramName = !encodedMsg.isEmpty() ? "name=" + encodedMsg : "";
365366
urlQueryParamJoiner.add(paramName);

biz.aQute.repository/test/aQute/bnd/repository/maven/provider/SonatypeDeploymentTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,13 @@ private static boolean hasRequiredEnvironment() {
319319
for (String var : vars) {
320320
existing = existing && ensureEnvVar(var);
321321
}
322+
if ("true".equals(System.getenv("GITHUB_ACTIONS"))) {
323+
// Running in GitHub Actions
324+
if ("false".equals(System.getenv("CANONICAL"))) {
325+
System.out.println("skipping tests cause in GITHUB but NOT in CANONICAL");
326+
existing = false;
327+
}
328+
}
322329
return existing;
323330
}
324331

0 commit comments

Comments
 (0)