-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·112 lines (96 loc) · 3.59 KB
/
release.sh
File metadata and controls
executable file
·112 lines (96 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Couchbase Spark Connector release script
# ========================================
#
# For internal use by Couchbase developers.
#
# Snapshot handling: snapshot builds are built locally, but not published to Sonatype, or Git-tagged.
#
# 1. Before running this script:
# * Bump the version numbers in build.sbt and README.md.
# * Push to Gerrit and get a review.
# * Pull the changes again.
#
# 2. Now edit the Git SHA to tag. The version will be read from build.sbt automatically.
vers_sha=04a6fcd35aca87cf2c7bee3e790af7f3cb69f866 # the Git sha being released
vers=$(sed -n 's/^version := "\(.*\)"/\1/p' build.sbt)
if [[ -z "$vers" ]]; then
echo "Unable to determine version from build.sbt"
exit 1
fi
# 3. Now run the script from the script's directory, e.g.
# cd couchbase-spark-connector
# chmod +x release.sh
# ./release.sh
#
# 4. After the script finishes successfully:
# * Bump the version numbers in build.sbt for next SNAPSHOT.
# * Push all changes to Gerrit for review, including changes to this file.
# * Release on Jira.
# * Release notes.
# * Release the uploaded bundle via https://central.sonatype.com/publishing/deployments
set -e
set -x
# Variables.
staging_dir=~/temp/staging/couchbase-spark-connector/$vers
maven_repo=~/.m2/repository
SKIP_REMOTE=${SKIP_REMOTE:-false} # set to true to skip Central/S3 uploads (dry run)
snapshot=false # whether this is a SNAPSHOT release
if [[ "$vers" == *"-SNAPSHOT" ]]; then
snapshot=true
fi
echo "Is snapshot build: ${snapshot}"
# Build and publish to the local Maven repo (used by the zipfile).
sbt clean +publishM2
# Publish to Maven Central Portal (unless dry run)
if ! $SKIP_REMOTE; then
if $snapshot; then
# Publish snapshots directly
sbt clean +publishSigned
else
# Creates a local staging dir
sbt clean +publishSigned
# Uploads the staging dir to Central Portal
sbt sonatypeCentralUpload
# Release via https://central.sonatype.com/publishing/deployments
fi
fi
# Build fatjar (possibly needed for Databricks)
sbt +assembly
# Upload the docs. We only upload 2.12, as there are no API differences in 2.13.
if ! $SKIP_REMOTE && ! $snapshot; then
s3cmd --acl-public --no-mime-magic -M -r put target/scala-2.12/api s3://docs.couchbase.com/sdk-api/couchbase-spark-connector-$vers/
fi
# Create and upload distribution zipfiles
for scala_version in "2.12" "2.13"
do
mkdir -p $staging_dir/$scala_version
m2_dir=$maven_repo/com/couchbase/client/spark-connector_$scala_version/$vers
if [[ ! -d "$m2_dir" ]]; then
echo "Expected Maven artifacts not found: $m2_dir"
echo "Ensure 'sbt +publishM2' completed successfully for Scala $scala_version and version $vers."
exit 1
fi
cp $m2_dir/* $staging_dir/$scala_version
# Copy the fat JAR built by sbt-assembly
asm_jar=target/scala-$scala_version/spark-connector-assembly-$vers.jar
if [[ ! -f "$asm_jar" ]]; then
echo "Assembly JAR not found: $asm_jar"
echo "Ensure 'sbt +assembly' completed successfully."
exit 1
fi
cp "$asm_jar" $staging_dir/$scala_version
pushd $staging_dir/$scala_version
# Create and upload the zipfile.
# We still do this for SNAPSHOT to make it easy for users to access.
zipfile=Couchbase-Spark-Connector_$scala_version-$vers.zip
zip $zipfile *.jar *.pom spark-connector-assembly-$vers.jar
if ! $SKIP_REMOTE; then
s3cmd --acl-public --no-mime-magic -M -r put $zipfile s3://packages.couchbase.com/clients/connectors/spark/$vers/
fi
popd
done
# Git tagging.
if ! $SKIP_REMOTE && ! $snapshot; then
git tag -f -s -m "$vers" $vers $vers_sha
git push gerrit $vers
fi