Răsfoiți Sursa

build: upload maven snapshots to updates server

Kirill Vainer 10 ani în urmă
părinte
comite
e5b3646fe4
6 a modificat fișierele cu 44 adăugiri și 33 ștergeri
  1. 5 0
      .travis.yml
  2. 1 0
      build.gradle
  3. 31 33
      common.gradle
  4. 1 0
      private/known_hosts
  5. BIN
      private/www-updater.key.enc
  6. 6 0
      upload.gradle

+ 5 - 0
.travis.yml

@@ -25,6 +25,7 @@ install:
 script:
   - ./gradlew check
   - ./gradlew createZipDistribution
+  - ./gradlew uploadArchives
 
 before_deploy:
   - export RELEASE_DIST=$(ls build/distributions/*.zip)
@@ -40,6 +41,10 @@ deploy:
     repo: jMonkeyEngine/jmonkeyengine
     tags: true
 
+before_install:
+  - openssl aes-256-cbc -K $encrypted_a1949b55824a_key -iv $encrypted_a1949b55824a_iv 
+    -in private/www-updater.key.enc -out private/www-updater.key -d
+
 # before_install:
   # required libs for android build tools
   # sudo apt-get update

+ 1 - 0
build.gradle

@@ -11,6 +11,7 @@ buildscript {
 
 apply plugin: 'base'
 apply from: file('version.gradle')
+apply from: file('upload.gradle')
 
 // This is applied to all sub projects
 subprojects {

+ 31 - 33
common.gradle

@@ -4,7 +4,6 @@
 
 apply plugin: 'java'
 apply plugin: 'maven'
-apply plugin: 'maven-publish'
 
 group = 'com.jme3'
 version = jmePomVersion
@@ -19,15 +18,20 @@ repositories {
     }
 }
 
+configurations {
+    deployerJars
+}
+
 dependencies {
     // Adding dependencies here will add the dependencies to each subproject.
     testCompile group: 'junit', name: 'junit', version: '4.10'
+    deployerJars "org.apache.maven.wagon:wagon-ssh:2.9"
 }
 
 jar {
     manifest {
         attributes 'Implementation-Title': 'jMonkeyEngine',
-                   'Implementation-Version': version
+                   'Implementation-Version': jmeFullVersion
     }
 }
 
@@ -63,41 +67,35 @@ artifacts {
     }
 }
 
-publishing {
-    publications {
-        maven(MavenPublication) {
-            from components.java
-            artifact sourcesJar
-            artifact javadocJar
-
-            pom.withXml {
-                asNode().children().last() + {
-                        resolveStrategy = Closure.DELEGATE_FIRST
-                        name POM_NAME
-                        description POM_DESCRIPTION
-                        url POM_URL
-                        scm {
-                            url POM_SCM_URL
-                            connection POM_SCM_CONNECTION
-                            developerConnection POM_SCM_DEVELOPER_CONNECTION
-                        }
-                        licenses {
-                            license {
-                                name POM_LICENSE_NAME
-                                url POM_LICENSE_URL
-                                distribution POM_LICENSE_DISTRIBUTION
-                            }
-                        }
+uploadArchives {
+    repositories.mavenDeployer {
+        configuration = configurations.deployerJars
+        
+        // disable this otherwise it will fill up the server with stale jars
+        uniqueVersion = false
+        
+        repository(url: "scp://updates.jmonkeyengine.org/var/www/updates/maven") {
+             authentication(userName: "www-updater", privateKey: "private/www-updater.key")
+        }
+        
+        pom.project {
+            name POM_NAME
+            description POM_DESCRIPTION
+            url POM_URL
+            scm {
+                url POM_SCM_URL
+                connection POM_SCM_CONNECTION
+                developerConnection POM_SCM_DEVELOPER_CONNECTION
+            }
+            licenses {
+                license {
+                    name POM_LICENSE_NAME
+                    url POM_LICENSE_URL
+                    distribution POM_LICENSE_DISTRIBUTION
                 }
             }
         }
     }
-
-    repositories {
-        maven {
-            url "${rootProject.buildDir}/repo" // change to point to your repo, e.g. http://my.org/repo
-        }
-    }
 }
 
 task createFolders(description: 'Creates the source folders if they do not exist.') doLast {

+ 1 - 0
private/known_hosts

@@ -0,0 +1 @@
+updates.jmonkeyengine.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5bNOiZwU5dF62nBllxkjiSIfn0k6RVfprvO1aUypRmARD3/MKJKg7cGLezlLKaHZtVs84VpEqpmg5IzPAXWEmxUw1oke70uYMli7JV+4oPAeQRFwUdldP98I5h9VHwSjBqMycRLkxYaHF8edIPt1Zsa2dM3qrufy71ndQoFF6g7QxmT7gsTxwcNufDxymIgiAna/Qp2fr0YCLCiB8RQ7JTHfqA3dOWw0wz7AwfBTwwDCHkVxB5B4nz5iZxFr0scvqcae8vMncq8xKS7OMrLbn6asVaF6dDu+5Jc0mqxma5Qg7VC1xQXZsvlRISfrTFhQMhEx+j9w5snzihrlFnZ35

BIN
private/www-updater.key.enc


+ 6 - 0
upload.gradle

@@ -0,0 +1,6 @@
+task copySshKnownHosts(type: Copy) {
+    from 'private/known_hosts'
+    into System.properties['user.home'] + '/.ssh'
+}
+
+uploadArchives.dependsOn copySshKnownHosts