11#! /bin/bash
2- set -x
32
43# Set Gradle daemon JVM args
54mkdir ~ /.gradle
@@ -11,14 +10,15 @@ grailsVersion="${grailsVersion#*=}"
1110grailsVersion=" ${grailsVersion// [[:blank:]\'\" ]/ } "
1211
1312echo " Project Version: '$grailsVersion '"
14- echo " Gradle command to be run: '$GRADLE_CMD '"
13+
14+ git config --global credential.helper " store --file=~/.git-credentials"
15+ echo " https://$GH_TOKEN :@github.com" > ~ /.git-credentials
1516
1617EXIT_STATUS=0
1718./gradlew --stop
1819
1920if [[ $TRAVIS_TAG =~ ^v[[:digit:]] ]]; then
2021 echo " Tagged Release Skipping Tests for Publish"
21- ./travis-publish-archives.sh
2222else
2323 echo " Executing tests"
2424 ./gradlew --stacktrace test -x grails-test-suite-web:test || EXIT_STATUS=$?
3434 fi
3535fi
3636
37- export EXIT_STATUS
38- export grailsVersion
39- # done. after build, then after_success will run if EXIT_STATUS is 0
40- #
41- # This also means that the later modifications to EXIT_STATUS will not affect
42- # the build status: Build could now be success, even though the later steps will
43- # change EXIT_STATUS variable
37+
38+ if [[ $TRAVIS_PULL_REQUEST == ' false' && $EXIT_STATUS -eq 0
39+ && $TRAVIS_REPO_SLUG == grails/grails-core && ( $TRAVIS_TAG =~ ^v[[:digit:]] || $TRAVIS_BRANCH =~ ^master| [23]\. .\. x$ ) ]]; then
40+ # files encrypted with 'openssl aes-256-cbc -in <INPUT FILE> -out <OUTPUT_FILE> -pass pass:$SIGNING_PASSPHRASE'
41+ openssl aes-256-cbc -pass pass:$SIGNING_PASSPHRASE -in secring.gpg.enc -out secring.gpg -d
42+ openssl aes-256-cbc -pass pass:$SIGNING_PASSPHRASE -in pubring.gpg.enc -out pubring.gpg -d
43+ openssl aes-256-cbc -pass pass:$SIGNING_PASSPHRASE -in settings.xml.enc -out settings.xml -d
44+ mkdir -p ~ /.m2
45+ cp settings.xml ~ /.m2/settings.xml
46+
47+ mv ~ /.gradle/gradle.properties{,.orig}
48+ echo " org.gradle.jvmargs=-XX\:MaxPermSize\=1024m -Xmx1500m -Dfile.encoding\=UTF-8 -Duser.country\=US -Duser.language\=en -Duser.variant" >> ~ /.gradle/gradle.properties
49+ echo " org.gradle.daemon=true" >> ~ /.gradle/gradle.properties
50+ ./gradlew --stop
51+ # ./gradlew groovydoc
52+ mv ~ /.gradle/gradle.properties{.orig,}
53+
54+ echo " Publishing archives"
55+
56+ gpg --keyserver keyserver.ubuntu.com --recv-key $SIGNING_KEY
57+
58+ echo " Running Gradle publish for branch $TRAVIS_BRANCH "
59+
60+ if [[ $TRAVIS_TAG =~ ^v[[:digit:]] ]]; then
61+ ./gradlew -Psigning.keyId=" $SIGNING_KEY " -Psigning.password=" $SIGNING_PASSPHRASE " -Psigning.secretKeyRingFile=" ${TRAVIS_BUILD_DIR} /secring.gpg" publish uploadArchives -x grails-bom:uploadArchives -x grails-dependencies:uploadArchives || EXIT_STATUS=$?
62+ ./gradlew closeAndPromoteRepository
63+
64+ if [[ $EXIT_STATUS == 0 ]]; then
65+ ./gradlew --stop
66+ # wait 30 seconds to ensure the previous promotion completes
67+ sleep 30
68+ ./gradlew -Psigning.keyId=" $SIGNING_KEY " -Psigning.password=" $SIGNING_PASSPHRASE " -Psigning.secretKeyRingFile=" ${TRAVIS_BUILD_DIR} /secring.gpg" grails-dependencies:uploadArchives grails-bom:uploadArchives || EXIT_STATUS=$?
69+ ./gradlew closeAndPromoteRepository
70+ fi
71+
72+ if [[ $EXIT_STATUS == 0 ]]; then
73+ ./gradlew assemble || EXIT_STATUS=$?
74+ fi
75+
76+ # Configure GIT
77+ git config --global user.name " $GIT_NAME "
78+ git config --global user.email " $GIT_EMAIL "
79+ git config --global credential.helper " store --file=~/.git-credentials"
80+
81+ # Tag and release the docs
82+ cd ..
83+ git clone https://${GH_TOKEN} @github.com/grails/grails-doc.git grails-doc
84+ cd grails-doc
85+ git branch --track 3.1.x remotes/origin/3.1.x
86+ git checkout 3.1.x
87+
88+ echo " grails.version=${TRAVIS_TAG: 1} " > gradle.properties
89+ git add gradle.properties
90+ git commit -m " Release $TRAVIS_TAG docs"
91+ git tag $TRAVIS_TAG
92+ git push --tags
93+ git push
94+ cd ..
95+
96+ # Update the website
97+ git clone https://${GH_TOKEN} @github.com/grails/grails-static-website.git
98+ cd grails-static-website
99+ echo -e " ${TRAVIS_TAG: 1} " >> generator/src/main/resources/versions
100+ git add generator/src/main/resources/versions
101+ git commit -m " Release Grails $TRAVIS_TAG "
102+ git push
103+ cd ..
104+
105+ # Rebuild Artifactory index
106+ curl -H " X-Api-Key:$ARTIFACTORY_API_KEY " -X POST " http://repo.grails.org/grails/api/maven?repos=libs-releases-local,plugins-releases-local,plugins3-releases-local,core&force=1"
107+
108+ elif [[ $TRAVIS_BRANCH =~ ^master| [23]\. .\. x$ ]]; then
109+ ./gradlew -Psigning.keyId=" $SIGNING_KEY " -Psigning.password=" $SIGNING_PASSPHRASE " -Psigning.secretKeyRingFile=" ${TRAVIS_BUILD_DIR} /secring.gpg" publish || EXIT_STATUS=$?
110+ fi
111+
112+ fi
113+
114+ # if [[ $EXIT_STATUS == 0 ]]; then
115+ # ./gradlew travisciTrigger -i
116+ # fi
44117
45118exit $EXIT_STATUS
0 commit comments