diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..79d5a493 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,69 @@ +# Handle line endings automatically for files detected as text +# and leave all files detected as binary untouched. +* text=auto + +# +# The above will handle all files NOT found below +# +# These files are text and should be normalized (Convert crlf => lf) +*.adoc text +*.conf text +*.config text +*.css text +*.df text +*.extension text +*.groovy text +*.htm text +*.html text +*.java text +*.js text +*.json text +*.jsp text +*.jspf text +*.md text +*.properties text +*.sbt text +*.scala text +*.sh text +*.sql text +*.svg text +*.template text +*.tld text +*.txt text +*.vm text +*.wadl text +*.wsdl text +*.xhtml text +*.xml text +*.xsd text +*.yml text + +cipher text +jaas text +LICENSE text +NOTICE text + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.dll binary +*.ear binary +*.gif binary +*.ico binary +*.jar binary +*.jpg binary +*.jpeg binary +*.png binary +*.ser binary +*.so binary +*.war binary +*.zip binary +*.exe binary +*.gz binary + +#Windows +*.bat text eol=crlf +*.cmd text eol=crlf + +#Unix/Linux +*.sh text eol=lf diff --git a/.gitignore b/.gitignore index 08874f96..ad0292e2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,16 @@ *.ipr *.iws +*.class +.settings/ +.checkstyle +target/ +tck/bin/ +.project +build/ +.classpath +.factorypath +test-output + +# Ignore a release.conf for perform_release/* script usage +release.conf diff --git a/perform_release/deploy_to_maven_central.sh b/perform_release/deploy_to_maven_central.sh new file mode 100755 index 00000000..93ef2bf1 --- /dev/null +++ b/perform_release/deploy_to_maven_central.sh @@ -0,0 +1,63 @@ +####################################################################### +## Copyright (c) 2016-2017 Contributors to the Eclipse Foundation +## +## See the NOTICE file(s) distributed with this work for additional +## information regarding copyright ownership. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +####################################################################### + +### Deploy to maven central +############################## + +#RELEASE_VERSION=1.0 +TAG=$RELEASE_VERSION +TARGET_MAVEN_REPO="central::default::https://oss.sonatype.org/service/local/staging/deploy/maven2" # Maven central +#TARGET_MAVEN_REPO="local::default::file:///tmp/maven-repository" # For testing - deploys to a local repository in /tmp + +# validates that variables are set +if echo XX"$RELEASE_VERSION"XX | grep XXXX > /dev/null + then + echo "ERROR: Some of the required environment variables are undefined. Please define and export them before running this script." >&2 + exit + fi + + +# add credentials for repository to settings.xml - for Maven Central, you need to have an account at Sonatype and access to the org.eclipse.microprofile group. See https://issues.sonatype.org/browse/OSSRH-32787 + +# checkout release tag + +git checkout "$TAG" +git reset --hard +git clean -f + +# prepare artifacts +## - signing with GPG key +## - Create GPG key - follow https://wiki.eclipse.org/GPG#Creating_your_GPG_keypair +## - upload your public key to one of the key servers that Maven Central checks: http://pgp.mit.edu:11371/, http://keyserver.ubuntu.com:11371/, http://pool.sks-keyservers.net:11371/ +## - optionally have the key signed by other people (e.g. at Eclipse) or just create a proof that the signature is created by you, e.g. by adding it to KEYS file in the github repo +## - specify GPG passphrase in settings.xml as: +## +## gpg.passphrase +## clear or encrypted text +## +## + +mvn --batch-mode -DaltDeploymentRepository="$TARGET_MAVEN_REPO" --projects .,api,tck -Pgpg-sign clean deploy + +# don't continue if the mvn command fails or aborted +if [[ x$? != x0 ]] + then + echo ERROR, aborting + exit +fi diff --git a/perform_release/prepare_release.sh b/perform_release/prepare_release.sh new file mode 100755 index 00000000..e12c7806 --- /dev/null +++ b/perform_release/prepare_release.sh @@ -0,0 +1,97 @@ +####################################################################### +## Copyright (c) 2016-2017 Contributors to the Eclipse Foundation +## +## See the NOTICE file(s) distributed with this work for additional +## information regarding copyright ownership. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +####################################################################### +#set -v + +################################## +# Specify the following variables +################################## + +# requirements for versions: +# - for BND: dash must come before a classifier, such as RC1 (e.g. 1.0-RC1 is valid while 1.0RC1 is invalid) +#RELEASE_VERSION=1.0-RC1 +#DEV_VERSION=1.0-SNAPSHOT +#GIT_USER='Ondrej Mihalyi' +#GIT_EMAIL='ondrej.mihalyi@gmail.com' +ORIGIN_REMOTE_REPO=origin # - the name of the upstream repository to push changes to. It should be the main repository, not a fork +BASE_REVISION=master # branch, tag or revision to make release from + +# try to read in these variables from a release.conf file +if [ -e release.conf ]; then + source release.conf +fi + +# check that we have all variables, noting each one that is missing +declare -a release_vars=("RELEASE_VERSION" "DEV_VERSION" "GIT_USER" "GIT_EMAIL" "ORIGIN_REMOTE_REPO" "BASE_REVISION") +declare -a missing_vars=() +for v in "${release_vars[@]}" +do + # echo "Checking ${v}=${!v}" + if [ "X${!v}" = "X" ]; then + echo "${v} is not defined" + missing_vars+=("${v}") + fi +done +if [ ${#missing_vars[@]} != 0 ]; then + echo "ERROR: the following required variables are not defined: ${missing_vars[@]}" + exit 1 +fi + +# Specify derived variables + +BRANCH=branch_$RELEASE_VERSION +TAG=$RELEASE_VERSION + +# set git identity + +git config user.name "$GIT_USER" +git config user.email "$GIT_EMAIL" + +# delete release branch and tag + +git checkout "$BASE_REVISION" +git reset --hard +git clean -f +git branch -D "$BRANCH" +git tag -d "$TAG" ## it's OK if tag cannot be found +# create and checkout release branch + +git branch "$BRANCH" +git checkout "$BRANCH" + +# prepare release + +mvn --batch-mode -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEV_VERSION -Dtag=$TAG release:clean release:prepare + +# don't continue if the mvn command fails or aborted +if [[ x$? != x0 ]] + then + echo ERROR, aborting + exit +fi + +# publish the release TAG +### If this fails because the tag already exists in the remote repo, +### you can delete the tag with `git tag -d "$TAG" && git push origin :refs/tags/"$TAG"` + +git push "$ORIGIN_REMOTE_REPO" "$TAG" + +# revert git identity + +git config --unset user.name +git config --unset user.email