Skip to content

Commit

Permalink
ALFREDAPI-552 pr corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
RVanhuysseXenit committed Aug 7, 2024
1 parent ad905f2 commit 8d31b87
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def format = new SimpleDateFormat("yyyy-MM-dd")

tasks.register("buildWebsiteScript", Exec) {
setGroup "documentation"
commandLine 'chmod', '+x', './build-website.sh'
commandLine 'bash', './build-website.sh'
}
assemble.dependsOn buildWebsiteScript
Expand All @@ -36,13 +35,20 @@ tasks.register("deployWebsiteToWebHost") {
ssh.run {
session(remotes.a2hosting) {
def remoteHomeDir = execute 'pwd'
def websiteDir = "${remoteHomeDir}/docs.xenit.eu"
def today = format.format(date)
put from: file("${layout.buildDirectory.get()}/website-alfred-api_${today}.tar.gz"), into: "${remoteHomeDir}/docs.xenit.eu/"
execute "mv ${remoteHomeDir}/docs.xenit.eu/alfred-api ${remoteHomeDir}/docs.xenit.eu/alfred-api_${today}_back"
execute "mkdir -p ${remoteHomeDir}/docs.xenit.eu/back/"
execute "tar vxzf ${remoteHomeDir}/docs.xenit.eu/website-alfred-api_${today}.tar.gz -C ${remoteHomeDir}/docs.xenit.eu/back/"
execute "tar vczf ${remoteHomeDir}/docs.xenit.eu/alfred-api_${today}_back.tar.gz -C ${remoteHomeDir}/docs.xenit.eu alfred-api_${today}_back"
remove "${remoteHomeDir}/docs.xenit.eu/alfred-api_${today}_back"
def websiteTar = "website-alfred-api_${today}.tar.gz"
def backupDir = "alfred-api_${today}_back"
project.logger.info("Uploading new website archive ${websiteTar} to ${websiteDir}")
put from: file("${layout.buildDirectory.get()}/${websiteTar}"), into: "${websiteDir}/"
project.logger.info("Move current website dir to backup dir ${remoteHomeDir}/${backupDir}")
execute "mv ${websiteDir}/alfred-api ${remoteHomeDir}/${backupDir}"
project.logger.info("Zipping backup: tar vczf alfred-api_${today}_back.tar.gz -C ${remoteHomeDir} ${backupDir}")
execute "tar vczf alfred-api_${today}_back.tar.gz -C ${remoteHomeDir} ${backupDir}"
project.logger.info("Unzipping new website: tar vxzf ${websiteTar} -C ${websiteDir}")
execute "tar vxzf ${websiteDir}/${websiteTar} -C ${websiteDir}"
project.logger.info("Removing uncompressed backup at ${remoteHomeDir}/${backupDir}")
remove "${remoteHomeDir}/${backupDir}"
}
}
}
Expand Down

0 comments on commit 8d31b87

Please sign in to comment.