Skip to content

Commit 792c581

Browse files
committed
Add release scripts
Signed-off-by: Scott M Stark <[email protected]>
1 parent 739d787 commit 792c581

File tree

4 files changed

+242
-0
lines changed

4 files changed

+242
-0
lines changed

.gitattributes

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Handle line endings automatically for files detected as text
2+
# and leave all files detected as binary untouched.
3+
* text=auto
4+
5+
#
6+
# The above will handle all files NOT found below
7+
#
8+
# These files are text and should be normalized (Convert crlf => lf)
9+
*.adoc text
10+
*.conf text
11+
*.config text
12+
*.css text
13+
*.df text
14+
*.extension text
15+
*.groovy text
16+
*.htm text
17+
*.html text
18+
*.java text
19+
*.js text
20+
*.json text
21+
*.jsp text
22+
*.jspf text
23+
*.md text
24+
*.properties text
25+
*.sbt text
26+
*.scala text
27+
*.sh text
28+
*.sql text
29+
*.svg text
30+
*.template text
31+
*.tld text
32+
*.txt text
33+
*.vm text
34+
*.wadl text
35+
*.wsdl text
36+
*.xhtml text
37+
*.xml text
38+
*.xsd text
39+
*.yml text
40+
41+
cipher text
42+
jaas text
43+
LICENSE text
44+
NOTICE text
45+
46+
# These files are binary and should be left untouched
47+
# (binary is a macro for -text -diff)
48+
*.class binary
49+
*.dll binary
50+
*.ear binary
51+
*.gif binary
52+
*.ico binary
53+
*.jar binary
54+
*.jpg binary
55+
*.jpeg binary
56+
*.png binary
57+
*.ser binary
58+
*.so binary
59+
*.war binary
60+
*.zip binary
61+
*.exe binary
62+
*.gz binary
63+
64+
#Windows
65+
*.bat text eol=crlf
66+
*.cmd text eol=crlf
67+
68+
#Unix/Linux
69+
*.sh text eol=lf

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,16 @@
44
*.ipr
55
*.iws
66

7+
*.class
8+
.settings/
9+
.checkstyle
10+
target/
11+
tck/bin/
12+
.project
13+
build/
14+
.classpath
15+
.factorypath
16+
test-output
17+
18+
# Ignore a release.conf for perform_release/* script usage
19+
release.conf
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#######################################################################
2+
## Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
3+
##
4+
## See the NOTICE file(s) distributed with this work for additional
5+
## information regarding copyright ownership.
6+
##
7+
## Licensed under the Apache License, Version 2.0 (the "License");
8+
## you may not use this file except in compliance with the License.
9+
## You may obtain a copy of the License at
10+
##
11+
## http://www.apache.org/licenses/LICENSE-2.0
12+
##
13+
## Unless required by applicable law or agreed to in writing, software
14+
## distributed under the License is distributed on an "AS IS" BASIS,
15+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
## See the License for the specific language governing permissions and
17+
## limitations under the License.
18+
#######################################################################
19+
20+
### Deploy to maven central
21+
##############################
22+
23+
#RELEASE_VERSION=1.0
24+
TAG=$RELEASE_VERSION
25+
TARGET_MAVEN_REPO="central::default::https://oss.sonatype.org/service/local/staging/deploy/maven2" # Maven central
26+
#TARGET_MAVEN_REPO="local::default::file:///tmp/maven-repository" # For testing - deploys to a local repository in /tmp
27+
28+
# validates that variables are set
29+
if echo XX"$RELEASE_VERSION"XX | grep XXXX > /dev/null
30+
then
31+
echo "ERROR: Some of the required environment variables are undefined. Please define and export them before running this script." >&2
32+
exit
33+
fi
34+
35+
36+
# 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
37+
38+
# checkout release tag
39+
40+
git checkout "$TAG"
41+
git reset --hard
42+
git clean -f
43+
44+
# prepare artifacts
45+
## - signing with GPG key
46+
## - Create GPG key - follow https://wiki.eclipse.org/GPG#Creating_your_GPG_keypair
47+
## - 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/
48+
## - 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
49+
## - specify GPG passphrase in settings.xml as:
50+
## <server>
51+
## <id>gpg.passphrase</id>
52+
## <passphrase>clear or encrypted text</passphrase>
53+
## </server>
54+
##
55+
56+
mvn --batch-mode -DaltDeploymentRepository="$TARGET_MAVEN_REPO" --projects .,api,tck -Pgpg-sign clean deploy
57+
58+
# don't continue if the mvn command fails or aborted
59+
if [[ x$? != x0 ]]
60+
then
61+
echo ERROR, aborting
62+
exit
63+
fi

perform_release/prepare_release.sh

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#######################################################################
2+
## Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
3+
##
4+
## See the NOTICE file(s) distributed with this work for additional
5+
## information regarding copyright ownership.
6+
##
7+
## Licensed under the Apache License, Version 2.0 (the "License");
8+
## you may not use this file except in compliance with the License.
9+
## You may obtain a copy of the License at
10+
##
11+
## http://www.apache.org/licenses/LICENSE-2.0
12+
##
13+
## Unless required by applicable law or agreed to in writing, software
14+
## distributed under the License is distributed on an "AS IS" BASIS,
15+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
## See the License for the specific language governing permissions and
17+
## limitations under the License.
18+
#######################################################################
19+
#set -v
20+
21+
##################################
22+
# Specify the following variables
23+
##################################
24+
25+
# requirements for versions:
26+
# - for BND: dash must come before a classifier, such as RC1 (e.g. 1.0-RC1 is valid while 1.0RC1 is invalid)
27+
#RELEASE_VERSION=1.0-RC1
28+
#DEV_VERSION=1.0-SNAPSHOT
29+
#GIT_USER='Ondrej Mihalyi'
30+
#GIT_EMAIL='[email protected]'
31+
ORIGIN_REMOTE_REPO=origin # - the name of the upstream repository to push changes to. It should be the main repository, not a fork
32+
BASE_REVISION=master # branch, tag or revision to make release from
33+
34+
# try to read in these variables from a release.conf file
35+
if [ -e release.conf ]; then
36+
source release.conf
37+
fi
38+
39+
# check that we have all variables, noting each one that is missing
40+
declare -a release_vars=("RELEASE_VERSION" "DEV_VERSION" "GIT_USER" "GIT_EMAIL" "ORIGIN_REMOTE_REPO" "BASE_REVISION")
41+
declare -a missing_vars=()
42+
for v in "${release_vars[@]}"
43+
do
44+
# echo "Checking ${v}=${!v}"
45+
if [ "X${!v}" = "X" ]; then
46+
echo "${v} is not defined"
47+
missing_vars+=("${v}")
48+
fi
49+
done
50+
if [ ${#missing_vars[@]} != 0 ]; then
51+
echo "ERROR: the following required variables are not defined: ${missing_vars[@]}"
52+
exit 1
53+
fi
54+
55+
# Specify derived variables
56+
57+
BRANCH=branch_$RELEASE_VERSION
58+
TAG=$RELEASE_VERSION
59+
60+
# set git identity
61+
62+
git config user.name "$GIT_USER"
63+
git config user.email "$GIT_EMAIL"
64+
65+
# delete release branch and tag
66+
67+
git checkout "$BASE_REVISION"
68+
git reset --hard
69+
git clean -f
70+
git branch -D "$BRANCH"
71+
git tag -d "$TAG" ## it's OK if tag cannot be found
72+
# create and checkout release branch
73+
74+
git branch "$BRANCH"
75+
git checkout "$BRANCH"
76+
77+
# prepare release
78+
79+
mvn --batch-mode -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEV_VERSION -Dtag=$TAG release:clean release:prepare
80+
81+
# don't continue if the mvn command fails or aborted
82+
if [[ x$? != x0 ]]
83+
then
84+
echo ERROR, aborting
85+
exit
86+
fi
87+
88+
# publish the release TAG
89+
### If this fails because the tag already exists in the remote repo,
90+
### you can delete the tag with `git tag -d "$TAG" && git push origin :refs/tags/"$TAG"`
91+
92+
git push "$ORIGIN_REMOTE_REPO" "$TAG"
93+
94+
# revert git identity
95+
96+
git config --unset user.name
97+
git config --unset user.email

0 commit comments

Comments
 (0)