From 11467d84998715ab14a57832f35587ed1c1ad54e Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Wed, 8 Dec 2021 15:10:00 +0300 Subject: [PATCH] Add deployment scripts --- .gitignore | 1 + deploy/1-fetch-and-build.ps1 | 20 ++++++++++++++++++++ deploy/2-nuget-pack.ps1 | 6 ++++++ deploy/3-nuget-push.ps1 | 27 +++++++++++++++++++++++++++ deploy/4-npm-publish.ps1 | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 deploy/1-fetch-and-build.ps1 create mode 100644 deploy/2-nuget-pack.ps1 create mode 100644 deploy/3-nuget-push.ps1 create mode 100644 deploy/4-npm-publish.ps1 diff --git a/.gitignore b/.gitignore index 67c234a229..070c0c89d1 100644 --- a/.gitignore +++ b/.gitignore @@ -319,3 +319,4 @@ tempkey.jwk # appsettings.secrets.json appsettings.secrets.json deploy/nuget-api-key.txt +deploy/npm-auth-token.txt diff --git a/deploy/1-fetch-and-build.ps1 b/deploy/1-fetch-and-build.ps1 new file mode 100644 index 0000000000..8f0d16c136 --- /dev/null +++ b/deploy/1-fetch-and-build.ps1 @@ -0,0 +1,20 @@ +param( + [string]$branch +) + +if (!$branch) +{ + $branch = Read-Host "Enter the branch name" +} + +echo "`n-----=====[ PULLING ABP REPO - BRANCH: $branch ]=====-----`n" + +cd .. +git switch $branch +git pull origin + +echo "`n-----=====[ BUILDING ALL PROJECTS ]=====-----`n" +cd build +.\build-all.ps1 + +echo "`n-----=====[ BUILDING ALL PROJECTS COMPLETED]=====-----`n" \ No newline at end of file diff --git a/deploy/2-nuget-pack.ps1 b/deploy/2-nuget-pack.ps1 new file mode 100644 index 0000000000..82d6b31180 --- /dev/null +++ b/deploy/2-nuget-pack.ps1 @@ -0,0 +1,6 @@ +echo "`n-----=====[ CREATING NUGET PACKAGES ]=====-----`n" + +cd ..\nupkg +powershell -File pack.ps1 + +echo "`n-----=====[ CREATING NUGET PACKAGES COMPLETED ]=====-----`n" diff --git a/deploy/3-nuget-push.ps1 b/deploy/3-nuget-push.ps1 new file mode 100644 index 0000000000..f99e9adf55 --- /dev/null +++ b/deploy/3-nuget-push.ps1 @@ -0,0 +1,27 @@ +param( + [string]$nugetApiKey +) + +if (!$nugetApiKey) +{ + #reading password from file content + $passwordFileName = "nuget-api-key.txt" + $pathExists = Test-Path -Path $passwordFileName -PathType Leaf + if ($pathExists) + { + $nugetApiKey = Get-Content $passwordFileName + echo "Using NuGet API Key from $passwordFileName ..." + } +} + +if (!$nugetApiKey) +{ + $nugetApiKey = Read-Host "Enter the NuGet API KEY" +} + +echo "`n-----=====[ PUSHING PACKS TO NUGET ]=====-----`n" + +cd ..\nupkg +powershell -File push_packages.ps1 $nugetApiKey + +echo "`n-----=====[ PUSHING PACKS TO NUGET COMPLETED ]=====-----`n" diff --git a/deploy/4-npm-publish.ps1 b/deploy/4-npm-publish.ps1 new file mode 100644 index 0000000000..1941f66994 --- /dev/null +++ b/deploy/4-npm-publish.ps1 @@ -0,0 +1,33 @@ +param( + [string]$npmAuthToken +) + +if (!$npmAuthToken) +{ + #reading password from file content + $passwordFileName = "npm-auth-token.txt" + $pathExists = Test-Path -Path $passwordFileName -PathType Leaf + if ($pathExists) + { + $npmAuthToken = Get-Content $passwordFileName + echo "Using NPM Auth Token from $passwordFileName ..." + } +} + +if (!$npmAuthToken) +{ + $npmAuthToken = Read-Host "Enter the NPM Auth Token" +} + +cd ..\npm + +echo "`n-----=====[ SETTING NPM AUTH TOKEN ]=====-----`n" +npm set //registry.npmjs.org/:_authToken $npmAuthToken + +echo "`n-----=====[ PUSHING MVC PACKS TO NPM ]=====-----`n" +powershell -File publish-mvc.ps1 + +echo "`n-----=====[ PUSHING ANGULAR PACKS TO NPM ]=====-----`n" +powershell -File publish-ng.ps1 + +echo "`n-----=====[ PUSHING PACKS TO NPM COMPLETED ]=====-----`n"