-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Safe-guard publishing of artifacts on master to development versions
Since an actual release changes the version property but still results in a push to the `master` branch, we safe-guard publishing CI artifacts.
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
|
||
# Helper variables | ||
_REPO_ROOT=$(git rev-parse --show-toplevel) | ||
|
||
# Get current version as specified in the project configuration | ||
current_version() { | ||
grep -e '^version=.*$' "${_REPO_ROOT}/gradle.properties" | cut -d '=' -f 2 | ||
} | ||
|
||
## Different checks (versions and git) | ||
# Check if the supplied version is a development version | ||
is_development_version() { | ||
_version=$1 | ||
echo "${_version}" | grep -q -e '-SNAPSHOT$' | ||
} | ||
|
||
# Check if the supplied version is a (pre-)release version | ||
is_release_version() { | ||
_version=$1 | ||
echo "${_version}" | grep -v -q -e '-SNAPSHOT$' | ||
} | ||
|
||
# Check if the supplied version is a REAL pre-release version | ||
is_prerelease_version() { | ||
_version=$1 | ||
echo "${_version}" | grep -E -q -e '\.(RC|M)[[:digit:]]+$' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# Global variables | ||
REPO_ROOT=$(git rev-parse --show-toplevel) | ||
|
||
# shellcheck source=_functions.sh | ||
. "${REPO_ROOT}/scripts/_functions.sh" | ||
|
||
CURRENT_VERSION=$(current_version) | ||
if is_development_version "$CURRENT_VERSION"; then | ||
info "Current version '${CURRENT_VERSION}' is a development version." | ||
else | ||
info "Current version '${CURRENT_VERSION}' is a release version." | ||
exit 1 | ||
fi |