Skip to content

Fix #12046: skip publishing nightly build when no new commits since last publish #12074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,20 @@ jobs:
- name: Add SBT proxy repositories
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true

- name: Get version string for this build
run: |
ver=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1)
echo "This build version: $ver"
echo "THISBUILD_VERSION=$ver" >> $GITHUB_ENV

- name: Check whether not yet published
id: not_yet_published
continue-on-error: true
run: |
! ./project/scripts/is-version-published.sh "$THISBUILD_VERSION"

- name: Publish Nightly
if: "steps.not_yet_published.outcome == 'success'"
run: |
./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease"

Expand Down
45 changes: 45 additions & 0 deletions project/scripts/is-version-published.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

# Check whether a specific version of the Scala 3 compiler is published to Maven Central
#
# Usage:
# is-version-published.sh <version_string>
# e.g.
# ./is-version-published.sh 3.0.1-RC1-bin-20210413-f3c1468-NIGHTLY
#
# Exit status:
# zero if the specified version is published on Maven Central
# non-zero otherwise
#
# Notes:
# Will always say 'not yet published' for versions prior to 3.0.1-RC1-bin-20210413-f3c1468-NIGHTLY
# since the binary version scheme was changed at that point.

ver=$1
if [[ -z "$ver" ]]; then
echo "error: missing version parameter"
echo "usage: $0 <version_string>"
exit 2
fi

set -eu

# binary version is everything up to the first dot
binaryVersion="${ver%%.*}"

artifactId="scala3-compiler_$binaryVersion"
pom="$artifactId-$ver.pom"

maven_url=https://repo1.maven.org/maven2/org/scala-lang/$artifactId/$ver/$pom

echo "Checking whether $ver is published"
echo "at $maven_url"
echo ""

if curl --head --fail -L "$maven_url" ; then
echo "Version $ver is already published."
exit 0
else
echo "Version $ver is not yet published."
exit 10
fi