gctGenerator/scripts/deploy.ps1
2020-06-30 00:02:03 +02:00

30 lines
No EOL
697 B
PowerShell

# Stop on errors
$ErrorActionPreference = "Stop";
Set-StrictMode -Version Latest
# Hide progress bars
$global:ProgressPreference = 'SilentlyContinue';
Set-Location "./dist"
# Set git email and username
Write-Host "Configuring git"
git init
git config --local user.name "$env:PUBLISHER_NAME" | Out-Null;
git config --local user.email "$env:PUBLISHER_EMAIL" | Out-Null;
# Commit all files in the dist/ directory
Write-Host "Commiting build"
git add .;
git commit -m "auto-deployment";
try {
# Force push to gh-pages
Write-Host "Pushing to gh-pages branch";
git push -uqf $env:REPOSITORY_TOKEN HEAD:gh-pages 2>&1 | Out-Null;
}
catch {
Write-Error "Push failed";
}
Write-Host "Finished";