Update release script

This commit is contained in:
Pig Fang 2019-08-01 14:47:48 +08:00
parent d8eb04dc18
commit 5fab376248

View File

@ -2,24 +2,26 @@ $manifest = Invoke-WebRequest 'https://dev.azure.com/blessing-skin/51010f6d-9f99
$last = $manifest.latest
$current = (Get-Content package.json | ConvertFrom-Json).version
Write-Host "Latest version: $last. Current: $current" -ForegroundColor Blue
if ($last -eq $current) {
Write-Output "Latest version is $last. No need to publish." -ForegroundColor Green -BackgroundColor DarkMagenta
Write-Host "Latest version is $last. No need to publish." -ForegroundColor Green -BackgroundColor DarkMagenta
exit
}
Install-Module PSGitHub -Force
Write-Output "'PSGitHub' has been installed." -ForegroundColor Green
Write-Host "'PSGitHub' has been installed." -ForegroundColor Green
# Install dependencies
composer install --no-dev
Remove-Item vendor/bin -Recurse -Force
yarn
yarn build
Write-Output "Dependencies have been installed." -ForegroundColor Green
Write-Host "Dependencies have been installed." -ForegroundColor Green
$zip = "blessing-skin-server-$current.zip"
zip -9 -r $zip app bootstrap config database plugins public resources/lang resources/views resources/misc routes storage vendor .env.example artisan LICENSE README.md README_EN.md
Write-Output "Zip archive is created." -ForegroundColor Green
Write-Host "Zip archive is created." -ForegroundColor Green
New-Item dist -ItemType Directory
Set-Location dist
@ -28,7 +30,7 @@ Copy-Item -Path "../$zip" -Destination $zip
$manifest.latest = $current
$manifest.url = $manifest.url.Replace($last, $current)
ConvertTo-Json $manifest | Out-File -FilePath update_2.json
Write-Output "Update source is prepared." -ForegroundColor Green
Write-Host "Update source is prepared." -ForegroundColor Green
$azureToken = $env:AZURE_TOKEN
git config --global user.email 'g-plane@hotmail.com'
@ -37,7 +39,7 @@ git init
git add .
git commit -m "Publish"
git push -f "https://anything:$azureToken@dev.azure.com/blessing-skin/Blessing%20Skin%20Server/_git/Blessing%20Skin%20Server" master
Write-Output "Update source is pushed to Azure Repos." -ForegroundColor Green
Write-Host "Update source is pushed to Azure Repos." -ForegroundColor Green
$githubToken = $env:GITHUB_TOKEN | ConvertTo-SecureString -AsPlainText -Force
$enChangelog = Get-Content "../resources/misc/changelogs/en/$current.md"
@ -48,4 +50,4 @@ try {
} catch {
# Do nothing.
}
Write-Output "New version $current is published!" -ForegroundColor Green -BackgroundColor DarkMagenta
Write-Host "New version $current is published!" -ForegroundColor Green -BackgroundColor DarkMagenta