From a1468c8e0b1817e93e316e69df011da8778c0917 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 8 Oct 2015 21:33:14 +0200 Subject: [PATCH] Refine publish script --- Lawo.EmberPlusDoc/Content/Welcome.aml | 6 ++-- Publish.ps1 | 42 +++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Lawo.EmberPlusDoc/Content/Welcome.aml b/Lawo.EmberPlusDoc/Content/Welcome.aml index 786889e8..784cc1cd 100644 --- a/Lawo.EmberPlusDoc/Content/Welcome.aml +++ b/Lawo.EmberPlusDoc/Content/Welcome.aml @@ -49,7 +49,7 @@ - Assemblies, Tools and Documentation + v0.0.0.1 Release https://github.com/Lawo/ember-plus-sharp/releases/tag/v0.0.0.1 @@ -57,8 +57,8 @@ - Source Code - https://github.com/Lawo/ember-plus-sharp/archive/v0.0.0.1.zip + Latest Release + https://github.com/Lawo/ember-plus-sharp/releases diff --git a/Publish.ps1 b/Publish.ps1 index d71d6dec..8fd6a820 100644 --- a/Publish.ps1 +++ b/Publish.ps1 @@ -13,9 +13,10 @@ echo quit >>temp.ftp ftp -s:temp.ftp del temp.ftp -$packageDirectory = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName()) +$tempDirectory = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName()) +$packageDirectory = [IO.Path]::Combine($tempDirectory, [IO.Path]::GetRandomFileName()) [void][IO.Directory]::CreateDirectory($packageDirectory) -$packagePath = [IO.Path]::Combine($packageDirectory, $packageName) +$packagePath = [IO.Path]::Combine($tempDirectory, $packageName) $requestPath = "http://cimaster.lawo.de/ember-plus-sharp/trunk/bin/" + $packageName # Make sure package is no longer present @@ -27,9 +28,11 @@ try } catch { + "The current package has been deleted successfully." } # Start Build +"Starting build..." [void](Invoke-WebRequest "http://cimaster.lawo.de:8080/job/EmberPlusSharp_Windows_AnyCpu_Release/build?token=B497D548-5260-49C0-8932-5A40187E7866") # Download package as soon as it's available @@ -41,11 +44,46 @@ while (!$downloadSucceeded) { Invoke-WebRequest $requestPath -OutFile $packagePath $downloadSucceeded = $true + "The new package has been downloaded successfully." } catch { + "Waiting for the build to finish..." Start-Sleep -Seconds 10 } } +"Extracting package..." 7z x "$packagePath" -o"$packageDirectory" +$version = [Reflection.Assembly]::Loadfile([IO.Path]::Combine($packageDirectory, "GlowAnalyzerProxy.exe")).GetName().Version.ToString() +"Package version is " + $version + "." +$extension = [IO.Path]::GetExtension($packageName) +$newPackageName = $packageName.Replace($extension, "-" + $version + $extension) +Rename-Item $packagePath $newPackageName + +"Cloning gh-pages..." +$ghpagesDirectory = [IO.Path]::Combine($tempDirectory, [IO.Path]::GetRandomFileName()) +git clone -q --branch gh-pages "https://github.com/Lawo/ember-plus-sharp.git" "$ghpagesDirectory" +cd $ghpagesDirectory + +"Removing current documentation..." +Remove-Item * -Recurse -Exclude .git + +"Adding new documentation..." +$documentationPattern = [IO.Path]::Combine($packageDirectory, "Help", "*.*") +xcopy $documentationPattern . /e /q +git add -A + +"Committing documentation changes..." +$tag = "v" + $version +$message = "Publish " + $tag + " documentation." +git commit -m $message + +"Setting tag on master branch..." +git checkout -q master +git tag $tag + +"Pushing everything..." +# git push --all origin + +cd .. \ No newline at end of file