Ray Milkey | 8db3c10 | 2017-11-02 13:08:20 -0700 | [diff] [blame] | 1 | #!/bin/bash -ex |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 2 | # ----------------------------------------------------------------------------- |
| 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'Connor | 608e03a | 2015-05-21 17:56:07 -0700 | [diff] [blame] | 9 | set -e |
| 10 | |
Brian O'Connor | d730b22 | 2016-03-01 18:32:38 -0800 | [diff] [blame] | 11 | export NEW_VERSION=${1:-$ONOS_VERSION} |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 12 | DRY_RUN=${2:-""} |
| 13 | dryRun=0 |
| 14 | if [ "${DRY_RUN}" == "--dry-run" ]; then |
| 15 | dryRun=1 |
| 16 | fi |
| 17 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 18 | [ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1 |
| 19 | |
| 20 | export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT} |
| 21 | [ "$NEW_VERSION" != "$NEW_VERSION_SHORT" ] && echo "Version is a SNAPSHOT" && exit 1; |
| 22 | |
| 23 | cd $ONOS_ROOT |
| 24 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 25 | # Change the version |
| 26 | onos-change-version $NEW_VERSION |
Brian O'Connor | 6b30e1b | 2015-03-11 16:44:16 -0700 | [diff] [blame] | 27 | export ONOS_VERSION=$NEW_VERSION |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 28 | |
Thomas Vachuska | f765933 | 2016-03-02 00:36:55 -0800 | [diff] [blame] | 29 | # Validate integrity of the versioning |
| 30 | onos-validate-change-version |
| 31 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 32 | # Build ONOS & deploy to staging repo using the release profile. |
Ray Milkey | f77ea41 | 2018-08-10 17:37:28 -0700 | [diff] [blame] | 33 | bazel build onos |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 34 | |
Ray Milkey | 4867af2 | 2018-08-10 16:52:28 -0700 | [diff] [blame] | 35 | # Build ONOS docs |
Carmelo Cascone | d72dc52 | 2019-06-28 14:20:34 -0700 | [diff] [blame] | 36 | bazel build //docs:external |
Ray Milkey | 78ce400 | 2018-08-10 11:16:44 -0700 | [diff] [blame] | 37 | |
Ray Milkey | f77ea41 | 2018-08-10 17:37:28 -0700 | [diff] [blame] | 38 | if [ $dryRun -eq 0 ]; then |
| 39 | publish_url="oss.sonatype.org" |
| 40 | else |
| 41 | publish_url="" |
| 42 | fi |
Ray Milkey | 4867af2 | 2018-08-10 16:52:28 -0700 | [diff] [blame] | 43 | |
Ray Milkey | f77ea41 | 2018-08-10 17:37:28 -0700 | [diff] [blame] | 44 | # Create artifact catalog |
| 45 | onos-publish-catalog publishing-catalog |
| 46 | |
| 47 | # publish artifacts |
| 48 | onos-upload-artifacts.py publishing-catalog ${publish_url} |
Ray Milkey | abda299 | 2020-03-24 11:06:01 -0700 | [diff] [blame^] | 49 | if [ $dryRun -eq 0 ]; then |
| 50 | onos-upload-artifacts.py |
| 51 | else |
Thomas Vachuska | 7f2a356 | 2018-02-28 10:02:16 -0800 | [diff] [blame] | 52 | |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 53 | # 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 Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 55 | if [ $dryRun -eq 0 ]; then |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 56 | pushd tools/package/archetypes/ |
Ray Milkey | 548768f | 2019-07-02 15:01:56 -0700 | [diff] [blame] | 57 | mvn -q -B -Pstaging clean install && onos-archetypes-test -Pstaging && mvn -Pstaging -Prelease clean deploy |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 58 | popd |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 59 | else |
| 60 | pushd tools/package/archetypes/ |
Ray Milkey | 548768f | 2019-07-02 15:01:56 -0700 | [diff] [blame] | 61 | mvn -q -B clean install && onos-archetypes-test |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 62 | popd |
| 63 | fi |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 64 | |
Ray Milkey | d341e61 | 2017-11-02 15:03:56 -0700 | [diff] [blame] | 65 | if [ $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 |
| 69 | fi |