gctGenerator/scripts/deploy.ps1

30 lines
697 B
PowerShell
Raw Permalink Normal View History

# 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";
2020-06-29 10:25:20 +09:00
git push -uqf $env:REPOSITORY_TOKEN HEAD:gh-pages 2>&1 | Out-Null;
}
catch {
Write-Error "Push failed";
}
Write-Host "Finished";