@@ -29,6 +29,8 @@ pipeline {
2929 }
3030 environment {
3131 SONAR_TEST = credentials(' SONAR_TEST' )
32+ WORDPRESS_USERNAME = credentials(' WORDPRESS_USERNAME' )
33+ WORDPRESS_PASSWORD = credentials(' WORDPRESS_PASSWORD' )
3234 CODE_SOURCE_DEFAULT = " plugin"
3335 }
3436 steps {
@@ -50,7 +52,14 @@ pipeline {
5052 CACHE_KEY = ' v1-dependencies-' + HASH
5153
5254 container(' php' ) {
53- loadCache(CACHE_KEY )
55+ sh """
56+ load-config
57+ export AWS_PROFILE=AplazameSharedServices
58+ set -e
59+ aws s3 cp --quiet s3://aplazameshared-jenkins-cache/Aplazame-Backend/woocommerce/${ CACHE_KEY} cache.tar.gz || exit 0
60+ [ -f cache.tar.gz ] && tar -xf cache.tar.gz
61+ """
62+ // loadCache(CACHE_KEY)
5463 }
5564 }
5665 }
@@ -77,7 +86,15 @@ pipeline {
7786 }
7887 steps {
7988 container(' php' ) {
80- saveCache(CACHE_KEY ,[" ${ foldersCache} " ])
89+ sh """
90+ load-config
91+ export AWS_PROFILE=AplazameSharedServices
92+ set -e
93+ MATCHES=\$ (aws s3 ls s3://aplazameshared-jenkins-cache/Aplazame-Backend/woocommerce/${ CACHE_KEY} | wc -l)
94+ [ "\$ MATCHES" = "0" ] && [ ! -f cache.tar.gz ] && tar -czf cache.tar.gz vendor/ && aws s3 cp --quiet cache.tar.gz s3://aplazameshared-jenkins-cache/Aplazame-Backend/woocommerce/${ CACHE_KEY}
95+ exit 0
96+ """
97+ // saveCache(CACHE_KEY,["${foldersCache}"])
8198 }
8299 }
83100 }
@@ -136,8 +153,10 @@ pipeline {
136153 }
137154 container(' php' ) {
138155 sh """
139- echo "Deploy to S3"
140- #aws s3 cp --acl public-read aplazame.latest.zip s3://aplazame/modules/prestashop/
156+ echo "Deploy to S3"
157+ load-config
158+ export AWS_PROFILE=Aplazame
159+ aws s3 cp --acl public-read aplazame.latest.zip s3://aplazame/modules/woocommerce/
141160 """
142161 }
143162 }
@@ -174,7 +193,10 @@ pipeline {
174193 container(' php' ) {
175194 sh """
176195 echo "***************Create Release***************"
177- #gh release create v$BUILD_NUMBER --notes "Release created by Jenkins.<br />Build: $BUILD_TAG ;$BUILD_URL >"
196+ export APP_VERSION="\$ (cat Makefile | grep 'version ?=' | cut -d '=' -f2)"
197+ echo \$ APP_VERSION
198+ echo "\$ APP_VERSION" > APP_VERSION.tmp
199+ gh release create \$ APP_VERSION --notes "Release created by Jenkins.<br />Build: $BUILD_TAG ;$BUILD_URL >"
178200 """
179201 }
180202 }
@@ -209,12 +231,16 @@ pipeline {
209231 """
210232 sh """
211233 echo "****************Tag Release******************************"
212- #svn cp svn/trunk svn/tags/$BUILD_TAG :1
234+ export APP_VERSION="\$ (cat APP_VERSION.tmp)"
235+ echo \$ APP_VERSION
236+ svn cp svn/trunk svn/tags/\$ APP_VERSION:1
237+ """
238+ sh """
239+ echo "****************Commit to Wordpress******************************"
240+ export APP_VERSION="\$ (cat APP_VERSION.tmp)"
241+ echo \$ APP_VERSION
242+ svn ci --no-auth-cache --username ${ WORDPRESS_USERNAME} --password ${ WORDPRESS_PASSWORD} svn -m "tagging version \$ APP_VERSION"
213243 """
214- // sh """
215- // echo "****************Commit to Wordpress******************************"
216- // #svn ci --no-auth-cache --username $WP_USERNAME --password $WP_PASSWORD svn -m "tagging version ${$BUILD_TAG:1}"
217- // """
218244 }
219245 }
220246 }
0 commit comments