2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2016 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
12 if [[ "$P2ZIP_URL" == "" ]]; then
13 P2ZIP_URL=opendaylight.snapshot/$(find . -name "*.zip" -type f -exec ls "{}" + | head -1)
14 FILE_NAME=$(echo "$P2ZIP_URL" | awk -F'/' '{ print $NF }')
15 RELEASE_PATH="snapshot"
17 FILE_NAME=$(echo "$P2ZIP_URL" | awk -F'/' '{ print $NF }')
18 VERSION=$(echo "$P2ZIP_URL" | awk -F'/' '{ print $(NF-1) }')
19 RELEASE_PATH="release/$VERSION"
20 wget --quiet "$P2ZIP_URL" -O "$FILE_NAME"
23 # If we detect a snapshot build then release to a snapshot repo
24 # YangIDE has indicated that the only want the latest snapshot released to
25 # the snapshot directory.
26 if echo "$P2ZIP_URL" | grep opendaylight.snapshot; then
27 RELEASE_PATH="snapshot"
30 cat > "${WORKSPACE}/pom.xml" <<EOF
31 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
32 <modelVersion>4.0.0</modelVersion>
33 <groupId>org.opendaylight.$PROJECT</groupId>
34 <artifactId>p2repo</artifactId>
35 <version>1.0.0-SNAPSHOT</version>
36 <packaging>pom</packaging>
41 <groupId>org.apache.maven.plugins</groupId>
42 <artifactId>maven-deploy-plugin</artifactId>
43 <version>2.8.2</version>
49 <groupId>org.sonatype.plugins</groupId>
50 <artifactId>maven-upload-plugin</artifactId>
51 <version>0.0.1</version>
57 <goal>upload-file</goal>
60 <serverId>opendaylight-p2</serverId>
61 <repositoryUrl>https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed</repositoryUrl>
62 <file>$FILE_NAME</file>
63 <repositoryPath>org.opendaylight.$PROJECT/$RELEASE_PATH</repositoryPath>