blob: 2cda036c3c253e69cf4b60b71266df815bd0f853 [file] [log] [blame]
Ray Milkey8db3c102017-11-02 13:08:20 -07001#!/bin/bash -ex
Thomas Vachuska683b31b2015-01-26 11:54:31 -08002# -----------------------------------------------------------------------------
3# Drives the ONOS release process.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
Brian O'Connor608e03a2015-05-21 17:56:07 -07009set -e
10
Brian O'Connord730b222016-03-01 18:32:38 -080011export NEW_VERSION=${1:-$ONOS_VERSION}
Ray Milkey13d3ae32017-01-03 15:00:04 -080012DRY_RUN=${2:-""}
13dryRun=0
14if [ "${DRY_RUN}" == "--dry-run" ]; then
15 dryRun=1
16fi
17
Thomas Vachuska683b31b2015-01-26 11:54:31 -080018[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
19
20export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
21[ "$NEW_VERSION" != "$NEW_VERSION_SHORT" ] && echo "Version is a SNAPSHOT" && exit 1;
22
23cd $ONOS_ROOT
24
Thomas Vachuska683b31b2015-01-26 11:54:31 -080025# Change the version
26onos-change-version $NEW_VERSION
Brian O'Connor6b30e1b2015-03-11 16:44:16 -070027export ONOS_VERSION=$NEW_VERSION
Thomas Vachuska683b31b2015-01-26 11:54:31 -080028
Thomas Vachuskaf7659332016-03-02 00:36:55 -080029# Validate integrity of the versioning
30onos-validate-change-version
31
Thomas Vachuska683b31b2015-01-26 11:54:31 -080032# Build ONOS & deploy to staging repo using the release profile.
Ray Milkeyf77ea412018-08-10 17:37:28 -070033bazel build onos
Thomas Vachuska683b31b2015-01-26 11:54:31 -080034
Ray Milkey4867af22018-08-10 16:52:28 -070035# Build ONOS docs
Carmelo Casconed72dc522019-06-28 14:20:34 -070036bazel build //docs:external
Ray Milkey78ce4002018-08-10 11:16:44 -070037
Ray Milkeyf77ea412018-08-10 17:37:28 -070038if [ $dryRun -eq 0 ]; then
39 publish_url="oss.sonatype.org"
40else
41 publish_url=""
42fi
Ray Milkey4867af22018-08-10 16:52:28 -070043
Ray Milkeyf77ea412018-08-10 17:37:28 -070044# Create artifact catalog
45onos-publish-catalog publishing-catalog
46
47# publish artifacts
48onos-upload-artifacts.py publishing-catalog ${publish_url}
Ray Milkeyabda2992020-03-24 11:06:01 -070049if [ $dryRun -eq 0 ]; then
50 onos-upload-artifacts.py
51else
Thomas Vachuska7f2a3562018-02-28 10:02:16 -080052
Thomas Vachuska683b31b2015-01-26 11:54:31 -080053# Build ONOS archetypes & deploy to staging repo using the release profile.
54# Note that release of the staging repository is a separate manual step.
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080055if [ $dryRun -eq 0 ]; then
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080056 pushd tools/package/archetypes/
Ray Milkey548768f2019-07-02 15:01:56 -070057 mvn -q -B -Pstaging clean install && onos-archetypes-test -Pstaging && mvn -Pstaging -Prelease clean deploy
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080058 popd
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080059else
60 pushd tools/package/archetypes/
Ray Milkey548768f2019-07-02 15:01:56 -070061 mvn -q -B clean install && onos-archetypes-test
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080062 popd
63fi
Thomas Vachuska683b31b2015-01-26 11:54:31 -080064
Ray Milkeyd341e612017-11-02 15:03:56 -070065if [ $dryRun -eq 0 ]; then
66 # Commit newly versioned artifacts and issue a tag.
67 git commit -a -m"Tagging $NEW_VERSION"
68 git tag -sm"Tagging $NEW_VERSION" $NEW_VERSION #signed tag
69fi