Skip to content

Commit 090b1b1

Browse files
authored
Merge pull request #12074 from griggt/fix-#12046
Fix #12046: skip publishing nightly build when no new commits since last publish
2 parents 08dab95 + bc36014 commit 090b1b1

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,20 @@ jobs:
447447
- name: Add SBT proxy repositories
448448
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
449449

450+
- name: Get version string for this build
451+
run: |
452+
ver=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1)
453+
echo "This build version: $ver"
454+
echo "THISBUILD_VERSION=$ver" >> $GITHUB_ENV
455+
456+
- name: Check whether not yet published
457+
id: not_yet_published
458+
continue-on-error: true
459+
run: |
460+
! ./project/scripts/is-version-published.sh "$THISBUILD_VERSION"
461+
450462
- name: Publish Nightly
463+
if: "steps.not_yet_published.outcome == 'success'"
451464
run: |
452465
./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease"
453466
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
# Check whether a specific version of the Scala 3 compiler is published to Maven Central
4+
#
5+
# Usage:
6+
# is-version-published.sh <version_string>
7+
# e.g.
8+
# ./is-version-published.sh 3.0.1-RC1-bin-20210413-f3c1468-NIGHTLY
9+
#
10+
# Exit status:
11+
# zero if the specified version is published on Maven Central
12+
# non-zero otherwise
13+
#
14+
# Notes:
15+
# Will always say 'not yet published' for versions prior to 3.0.1-RC1-bin-20210413-f3c1468-NIGHTLY
16+
# since the binary version scheme was changed at that point.
17+
18+
ver=$1
19+
if [[ -z "$ver" ]]; then
20+
echo "error: missing version parameter"
21+
echo "usage: $0 <version_string>"
22+
exit 2
23+
fi
24+
25+
set -eu
26+
27+
# binary version is everything up to the first dot
28+
binaryVersion="${ver%%.*}"
29+
30+
artifactId="scala3-compiler_$binaryVersion"
31+
pom="$artifactId-$ver.pom"
32+
33+
maven_url=https://repo1.maven.org/maven2/org/scala-lang/$artifactId/$ver/$pom
34+
35+
echo "Checking whether $ver is published"
36+
echo "at $maven_url"
37+
echo ""
38+
39+
if curl --head --fail -L "$maven_url" ; then
40+
echo "Version $ver is already published."
41+
exit 0
42+
else
43+
echo "Version $ver is not yet published."
44+
exit 10
45+
fi

0 commit comments

Comments
 (0)