зеркало из https://github.com/microsoft/MSLab.git
[Actions] Add option to skip a release (#377)
* Add option to skip a release * updates to build script
This commit is contained in:
Родитель
d447c2ff45
Коммит
379792d10b
|
@ -13,6 +13,7 @@ on:
|
|||
jobs:
|
||||
new-version:
|
||||
name: Bump version
|
||||
if: "!contains(github.event.head_commit.message, '[no release]')"
|
||||
runs-on: windows-2019
|
||||
outputs:
|
||||
previous_tag: ${{ steps.bump.outputs.previous_tag }}
|
||||
|
@ -46,6 +47,7 @@ jobs:
|
|||
|
||||
new-release:
|
||||
name: Create release
|
||||
if: "!contains(github.event.head_commit.message, '[no release]')"
|
||||
runs-on: windows-2019
|
||||
needs: new-version
|
||||
steps:
|
||||
|
|
16
build.ps1
16
build.ps1
|
@ -4,9 +4,15 @@ param(
|
|||
)
|
||||
|
||||
$baseDir = ".\Scripts\"
|
||||
$outputDir = ".\Output"
|
||||
$outputFile = "Release.zip"
|
||||
[array]$ignoredFiles = "0_Shared.ps1"
|
||||
|
||||
$releaseDirectory = New-Item -ItemType "Directory" -Path ".\" -Name "Output"
|
||||
if(Test-Path -Path $outputDir) {
|
||||
Remove-Item -Path $outputDir -Recurse
|
||||
}
|
||||
|
||||
$releaseDirectory = New-Item -ItemType "Directory" -Path ".\" -Name $outputDir
|
||||
$files = Get-ChildItem -Path $baseDir
|
||||
foreach($file in $files) {
|
||||
if($file.Name -in $ignoredFiles) {
|
||||
|
@ -19,6 +25,11 @@ foreach($file in $files) {
|
|||
# inline include
|
||||
if($line -match "^\s*\.\s+([^#]+)#\s\[!build-include-inline\]") {
|
||||
$includeFile = $Matches[1]
|
||||
|
||||
if($includeFile.Contains("`$PSScriptRoot")) {
|
||||
$includeFile = $includeFile.Replace("`$PSScriptRoot", ".")
|
||||
}
|
||||
|
||||
if($includeFile.StartsWith(".\")) {
|
||||
$includeFile = $includeFile.Substring(2)
|
||||
}
|
||||
|
@ -39,4 +50,5 @@ foreach($file in $files) {
|
|||
$outFile = Join-Path -Path $releaseDirectory -ChildPath $file.Name
|
||||
Set-Content -Path $outFile -Value $output
|
||||
}
|
||||
Compress-Archive -Path "$($releaseDirectory.FullName)\*" -DestinationPath Release.zip -CompressionLevel Optimal
|
||||
|
||||
Compress-Archive -Path "$($releaseDirectory.FullName)\*" -DestinationPath $outputFile -CompressionLevel Optimal -Force
|
||||
|
|
Загрузка…
Ссылка в новой задаче