Skip to content

Commit

Permalink
Configuration: Just one PR for RELEASE deployments (#59)
Browse files Browse the repository at this point in the history
* Configuration: Just one PR for RELEASE deployments

* Remove extra line

* Remove deployment in Bintray for releases

* Add badge

* Solve #16

* Remove bintray plugin because of @AdrianRaFo comment

* Fix URL (replace Bintray by Gradle Plugins Portal)

* Add more details because of @AdrianRaFo comment

* Format
  • Loading branch information
rachelcarmena authored Jun 14, 2020
1 parent 43a4f83 commit dd11431
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 25 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Hood

[![Maven metadata URL](https://img.shields.io/maven-metadata/v?color=blue&label=latest%20release&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fm2%2Fcom%2F47deg%2Fhood%2Fmaven-metadata.xml)](https://plugins.gradle.org/plugin/com.47deg.hood)

**Hood** is a `Gradle` plugin to compare benchmarks and set the result as a `Github` status for a `Pull Request`.
**Hood** is built on [Arrow](https://arrow-kt.io/), a Functional companion to Kotlin's Standard Library.

Please see the [Hood Microsite](https://47degrees.github.io/hood/) for more information.
Please see the [Hood Microsite](https://47degrees.github.io/hood/) for more information.
27 changes: 13 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
id "maven-publish"
id "com.gradle.plugin-publish" version "0.11.0"
id "org.jetbrains.kotlin.jvm" version "1.3.71"
id "com.jfrog.bintray" version "1.8.5"
id "com.jfrog.artifactory" version "4.15.2"
}

repositories {
Expand Down Expand Up @@ -81,17 +81,16 @@ def findPropertyOrEnv(String key) {
[project.properties[key], System.getenv(key)].find { it != null }
}

bintray {
publish = true
user = findPropertyOrEnv("BINTRAY_USER") ?: "no.bintray.user"
key = findPropertyOrEnv("BINTRAY_API_KEY") ?: "no.bintray.api.key"
publications = ["HoodPublication"]
configurations = ["archives"]
pkg {
repo = "hood"
name = project.name
userOrg = POM_DEVELOPER_ID
licenses = ["Apache-2.0"]
vcsUrl = "https://github.com/47degrees/hood.git"
}
artifactory {
contextUrl = 'https://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = findPropertyOrEnv("BINTRAY_USER") ?: "no.bintray.user"
password = findPropertyOrEnv("BINTRAY_API_KEY") ?: "no.bintray.api.key"
}
defaults {
publications 'HoodPublication'
}
}
}
6 changes: 3 additions & 3 deletions deploy-scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if [ "$TRAVIS_BRANCH" == "master" ]; then
if [[ "$VERSION_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Starting script for Release $VERSION_NAME"
. $(dirname $0)/deploy_release.sh
# elif [[ "$VERSION_NAME" == *-SNAPSHOT ]]; then
# echo "Starting script for Snapshot Release $VERSION_NAME"
# . $(dirname $0)/deploy_snapshot.sh
elif [[ "$VERSION_NAME" == *-SNAPSHOT ]]; then
echo "Starting script for Snapshot $VERSION_NAME"
. $(dirname $0)/deploy_snapshot.sh
else
echo "No deploy script matched version '$VERSION_NAME' on master"
fi
Expand Down
14 changes: 12 additions & 2 deletions deploy-scripts/deploy_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

function getProperty {
PROP_KEY=$1
PROP_VALUE=`cat gradle.properties | grep "$PROP_KEY" | cut -d'=' -f2`
PROP_VALUE=`cat gradle.properties | grep -e "^$PROP_KEY=" | cut -d'=' -f2`
echo $PROP_VALUE
}

Expand All @@ -14,4 +14,14 @@ function fail {

SLUG="47degrees/hood"
BRANCH="master"
VERSION_NAME=$(getProperty "version")

#
# If 'release_version' isn't published in Gradle Plugin Portal, 'version' value is replaced by 'release_version' value
#
RELEASE_VERSION=$(getProperty "release_version")
LATEST_PUBLISHED_VERSION=$(curl https://plugins.gradle.org/m2/com/47deg/hood/maven-metadata.xml | grep latest | cut -d'>' -f2 | cut -d'<' -f1)
if [ "$RELEASE_VERSION" != "$LATEST_PUBLISHED_VERSION" ]; then
sed -i "s/version.*/version=$RELEASE_VERSION/g" gradle.properties
fi

VERSION_NAME=$(getProperty "version")
3 changes: 1 addition & 2 deletions deploy-scripts/deploy_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
elif ! [[ "$VERSION_NAME" =~ $VERSION_PATTERN ]]; then
fail "Failed release deployment: wrong version. Expected '$VERSION_NAME' to have pattern 'X.Y.Z'"
else
./gradlew bintrayUpload
./gradlew -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET publishPlugins
echo "Release '$VERSION_NAME' deployed!"
fi
fi
4 changes: 2 additions & 2 deletions deploy-scripts/deploy_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
elif ! [[ "$VERSION_NAME" =~ $VERSION_PATTERN ]]; then
echo "Skipping snapshot deployment '$VERSION_NAME': This is probably a pre-release build"
else
./gradlew bintrayUpload
./gradlew artifactoryPublish
echo "Snapshot '$VERSION_NAME' deployed!"
fi
fi
11 changes: 10 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Package definitions
group=com.47deg
version=0.8.1
# Just SNAPSHOT versions
version=0.8.2-SNAPSHOT
# Just RELEASE versions
release_version=0.8.1
#
# NOTE:
#
# Update 'version' and 'release_version' when releasing.
# If 'release_version' isn't published, 'version' value will be replaced by 'release_version' value automatically when deploying.
# See deploy-scripts/deploy_common.sh

# Gradle options
org.gradle.warning.mode=all
Expand Down

0 comments on commit dd11431

Please sign in to comment.