diff --git a/.editorconfig b/.editorconfig index b4935371..14f8b6d2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,5 +9,5 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[*.{php,md,tpl,rs}] +[*.{php,md,ps1}] indent_size = 4 diff --git a/scripts/release.ps1 b/scripts/release.ps1 index b43b9f00..d54e9167 100644 --- a/scripts/release.ps1 +++ b/scripts/release.ps1 @@ -3,19 +3,23 @@ $last = $manifest.latest $current = (Get-Content package.json | ConvertFrom-Json).version if ($last -eq $current) { + Write-Host "Latest version is $last. No need to publish." -ForegroundColor Green -BackgroundColor DarkMagenta exit } Install-Module PSGitHub -Force +Write-Host "'PSGitHub' has been installed." -ForegroundColor Green # Install dependencies composer install --no-dev Remove-Item vendor/bin -Recurse -Force yarn yarn build +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-Host "Zip archive is created." -ForegroundColor Green New-Item dist -ItemType Directory Set-Location dist @@ -24,6 +28,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-Host "Update source is prepared." -ForegroundColor Green $azureToken = $env:AZURE_TOKEN git config --global user.email 'g-plane@hotmail.com' @@ -32,8 +37,15 @@ 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-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" $changelog = "`n---`n" + $enChangelog -New-GitHubRelease -Token $githubToken -Owner 'bs-community' -Repository 'blessing-skin-server' -TagName $current -ReleaseNote $changelog +$release = New-GitHubRelease -Token $githubToken -Owner 'bs-community' -Repository 'blessing-skin-server' -TagName $current -ReleaseNote $changelog +try { + New-GitHubReleaseAsset -Token $githubToken -Owner 'bs-community' -Repository 'blessing-skin-server' -ReleaseId $release.Id -Path $zip +} catch { + # Do nothing. +} +Write-Host "New version $current is published!" -ForegroundColor Green -BackgroundColor DarkMagenta