-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logic to not deploy to PSGallery if version lower than 1.0
- Loading branch information
Showing
1 changed file
with
41 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,64 +5,73 @@ Write-Host "Deploy Process:" -ForegroundColor Yellow | |
|
||
if ((! $ENV:APPVEYOR_PULL_REQUEST_NUMBER) -and ($ENV:APPVEYOR_REPO_BRANCH -eq 'master')) { | ||
|
||
#---------------------------------# | ||
# Publish to PS Gallery # | ||
#---------------------------------# | ||
if ($env:APPVEYOR_BUILD_VERSION -ge "1.0.0") { | ||
|
||
Try { | ||
#---------------------------------# | ||
# Publish to PS Gallery # | ||
#---------------------------------# | ||
|
||
Write-Host 'Publish to Powershell Gallery...' | ||
Try { | ||
|
||
$ModulePath = Join-Path $env:APPVEYOR_BUILD_FOLDER $env:APPVEYOR_PROJECT_NAME | ||
Write-Host 'Publish to Powershell Gallery...' | ||
|
||
Publish-Module -Path $ModulePath -NuGetApiKey $($env:psgallery_key) -Confirm:$false -ErrorAction Stop | ||
$ModulePath = Join-Path $env:APPVEYOR_BUILD_FOLDER $env:APPVEYOR_PROJECT_NAME | ||
|
||
Write-Host "$($env:APPVEYOR_PROJECT_NAME) published." -ForegroundColor Cyan | ||
Publish-Module -Path $ModulePath -NuGetApiKey $($env:psgallery_key) -Confirm:$false -ErrorAction Stop | ||
|
||
} Catch { | ||
Write-Host "$($env:APPVEYOR_PROJECT_NAME) published." -ForegroundColor Cyan | ||
|
||
Write-Warning "Publish Failed." | ||
throw $_ | ||
} Catch { | ||
|
||
} | ||
Write-Warning "Publish Failed." | ||
throw $_ | ||
|
||
#---------------------------------# | ||
# Push to Master Branch # | ||
#---------------------------------# | ||
} | ||
|
||
Try { | ||
#---------------------------------# | ||
# Push to Master Branch # | ||
#---------------------------------# | ||
|
||
Write-Host "Push Version update to GitHub..." | ||
Try { | ||
|
||
git config --global core.safecrlf false | ||
Write-Host "Push Version update to GitHub..." | ||
|
||
git config --global credential.helper store | ||
git config --global core.safecrlf false | ||
|
||
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):[email protected]`n" | ||
git config --global credential.helper store | ||
|
||
git config --global user.email "pete.maan+github@gmail.com" | ||
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n" | ||
|
||
git config --global user.name "Pete Maan" | ||
git config --global user.email "[email protected]" | ||
|
||
git checkout -q master | ||
git config --global user.name "Pete Maan" | ||
|
||
git add $(Join-Path "$env:APPVEYOR_PROJECT_NAME" "$env:APPVEYOR_PROJECT_NAME.psd1") | ||
git checkout -q master | ||
|
||
git status | ||
git add $(Join-Path "$env:APPVEYOR_PROJECT_NAME" "$env:APPVEYOR_PROJECT_NAME.psd1") | ||
|
||
git commit -s -m "Update Version" | ||
git status | ||
|
||
git push --porcelain origin master | ||
git commit -s -m ":bookmark: Update Version" | ||
|
||
Write-Host "$($env:APPVEYOR_PROJECT_NAME) updated version pushed to GitHub." -ForegroundColor Cyan | ||
git push --porcelain origin master | ||
|
||
} | ||
Write-Host "$($env:APPVEYOR_PROJECT_NAME) updated version pushed to GitHub." -ForegroundColor Cyan | ||
|
||
} | ||
|
||
Catch { | ||
Catch { | ||
|
||
Write-Warning "Push to GitHub failed." | ||
throw $_ | ||
Write-Warning "Push to GitHub failed." | ||
throw $_ | ||
|
||
} | ||
|
||
} | ||
|
||
Else { | ||
Write-Host "Nothing to Publish - version lower than 1.0.0" | ||
exit; | ||
} | ||
|
||
} | ||
|