Add nightly publication script for JIRO
[EMFCompare2.git] / releng / org.eclipse.emf.compare.releng / publish-nightly.sh
blobd75fe5ad72b90755bc401c75a0df55311fd2653b
1 #!/bin/sh
2 # ====================================================================
3 # Copyright (c) 2021 Obeo
4 # This program and the accompanying materials
5 # are made available under the terms of the Eclipse Public License 2.0
6 # which accompanies this distribution, and is available at
7 # https://www.eclipse.org/legal/epl-2.0
9 # Contributors:
10 # Obeo - initial API and implementation
11 # ====================================================================
13 if [ ${REFERENCE_TARGET_PLATFORM} != ${PLATFORM} ]; then
14 exit 1
17 # Exit on error
18 set -e
20 # The SSH account to use
21 export SSH_ACCOUNT="genie.emfcompare@projects-storage.eclipse.org"
23 NIGHTLIES_FOLDER="/home/data/httpd/download.eclipse.org/modeling/emf/compare/updates/nightly"
24 GROUP="modeling.emfcompare"
26 CORE_UPDATE_FOLDER=${WORKSPACE}/packaging/org.eclipse.emf.compare.update/target
27 EXTRAS_UPDATE_FOLDER=${WORKSPACE}/packaging/org.eclipse.emf.compare.update.extras/target
29 CORE_UPDATE_ZIP="$(ls ${CORE_UPDATE_FOLDER}/org.eclipse.emf.compare-*.zip | sort -V | tail -n1)"
30 EXTRAS_UPDATE_ZIP="$(ls ${EXTRAS_UPDATE_FOLDER}/org.eclipse.emf.compare.extras-*.zip | sort -V | tail -n1)"
32 CORE_ZIP_NAME=$(echo ${CORE_UPDATE_ZIP} | sed 's/.*\(org.eclipse.emf.compare-.*.zip\)$/\1/')
33 EXTRAS_ZIP_NAME=$(echo ${EXTRAS_UPDATE_ZIP} | sed 's/.*\(org.eclipse.emf.compare.extras-.*.zip\)$/\1/')
34 QUALIFIER=$(echo ${CORE_UPDATE_ZIP} | sed 's/.*org.eclipse.emf.compare-\(.*\).zip$/\1/')
36 P2_TIMESTAMP=$(date +"%s000")
38 ssh "${SSH_ACCOUNT}" mkdir -p ${NIGHTLIES_FOLDER}/${QUALIFIER}
39 scp -rp ${CORE_UPDATE_ZIP} ${EXTRAS_UPDATE_ZIP} "${SSH_ACCOUNT}:${NIGHTLIES_FOLDER}/${QUALIFIER}"
41 # make a composite with both "core" and "extras" features
42 cat > compositeArtifacts.xml <<EOF
43 <?xml version='1.0' encoding='UTF-8'?>
44 <?compositeArtifactRepository version='1.0.0'?>
45 <repository name='Eclipse EMF Compare ${QUALIFIER}' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
46 <properties size='1'>
47 <property name='p2.timestamp' value='${P2_TIMESTAMP}'/>
48 </properties>
49 <children size='2'>
50 <child location='core'/>
51 <child location='extras'/>
52 </children>
53 </repository>
54 EOF
55 cat > compositeContent.xml <<EOF
56 <?xml version='1.0' encoding='UTF-8'?>
57 <?compositeMetadataRepository version='1.0.0'?>
58 <repository name='Eclipse EMF Compare ${QUALIFIER}' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
59 <properties size='1'>
60 <property name='p2.timestamp' value='${P2_TIMESTAMP}'/>
61 </properties>
62 <children size='2'>
63 <child location='core'/>
64 <child location='extras'/>
65 </children>
66 </repository>
67 EOF
69 # push this composite to the download area as well
70 scp -rp compositeArtifacts.xml compositeContent.xml "${SSH_ACCOUNT}:${NIGHTLIES_FOLDER}/${QUALIFIER}"
72 ssh "${SSH_ACCOUNT}" -T <<EOF
73 pushd ${NIGHTLIES_FOLDER}/${QUALIFIER}
74 unzip "${CORE_ZIP_NAME}" -d core/
75 unzip "${EXTRAS_ZIP_NAME}" -d extras/
76 rm ${CORE_ZIP_NAME}
77 rm ${EXTRAS_ZIP_NAME}
78 popd
80 # make sure permissions are update for the emfcompare group
81 chgrp -R ${GROUP} ${NIGHTLIES_FOLDER}/${QUALIFIER}
82 chmod -R g+w ${NIGHTLIES_FOLDER}/${QUALIFIER}
84 pushd ${NIGHTLIES_FOLDER}/latest
85 rm -r *
86 cp -r ../${QUALIFIER}/* .
87 popd
88 EOF