From f462bc19164286fb9a960c977295101c5c2114b3 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 11:24:51 +0200 Subject: [PATCH 01/14] add build/release action from d365bap.tools --- .github/workflows/tmpl-build-release.yml | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/tmpl-build-release.yml diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml new file mode 100644 index 00000000..063c0526 --- /dev/null +++ b/.github/workflows/tmpl-build-release.yml @@ -0,0 +1,63 @@ +# Template for a reusable workflow to build and release a PowerShell module. +# The template expects the following PowerShell scripts in the build folder of the repository root +# that do the actual validated build and release: +# - vsts-prerequisities.ps1 +# - vsts-validate.ps1 +# - vsts-build.ps1 + +on: + workflow_call: + inputs: + autoversion: + description: "Determines if the module's build version number is automatically incremented" + default: $True + required: false + type: string + skippublish: + description: "Determines if the publishing to the PowerShell Gallery is skipped" + default: $False + required: false + type: string + skipghrelease: + description: "Determines if a GitHub release is created" + default: $False + required: false + type: string + secrets: + apikey: + description: "Key for the PowerShell Gallery API" + required: true + +jobs: + build-and-release: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v1 + - name: Install Prerequisites + run: .\build\vsts-prerequisites.ps1 + shell: powershell + - name: Validate + run: .\build\vsts-validate.ps1 + shell: powershell + - name: Build + run: .\build\vsts-build.ps1 -ApiKey ${{ secrets.apikey }} -AutoVersion:${{ inputs.autoversion }} -SkipPublish:${{ inputs.skippublish }} + shell: powershell + + - name: Get version + run: | + $publishDir = Get-Item -Path publish + [version]$version = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\d365bap.tools\d365bap.tools.psd1").ModuleVersion + $githubReleaseVersion = "$($version.Major).$($version.Minor).$($version.Build)" + "VERSION=$githubReleaseVersion" >> $env:GITHUB_ENV + shell: powershell + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + name: ${{ env.VERSION }} + tag_name: ${{ env.VERSION }} + draft: false + prerelease: true + generate_release_notes: true \ No newline at end of file From b93cd9868f59f23b75c5be789572be1a7f1eadac Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 11:26:21 +0200 Subject: [PATCH 02/14] add manual build and release action from d365bap.tools --- .github/workflows/build-manual.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/build-manual.yml diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml new file mode 100644 index 00000000..4b9f48ff --- /dev/null +++ b/.github/workflows/build-manual.yml @@ -0,0 +1,28 @@ +on: + workflow_dispatch: + inputs: + skippublish: + description: "Determines if the publishing to the PowerShell Gallery is skipped" + default: $True + required: false + type: choice + options: + - $False + - $True + skipghrelease: + description: "Determines if creation of a GitHub release is skipped" + default: $False + required: false + type: choice + options: + - $False + - $True + +jobs: + call-tmpl-build-release: + uses: ./.github/workflows/tmpl-build-release.yml + with: + skippublish: ${{ inputs.skippublish }} + skipghrelease: ${{ inputs.skipghrelease }} + secrets: + apikey: ${{ secrets.ApiKey }} \ No newline at end of file From 6039d9d89ad598afdd49da55d670363b2e40390b Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 11:46:45 +0200 Subject: [PATCH 03/14] update checkout version --- .github/workflows/tmpl-build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 063c0526..5e8bd8a5 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -34,7 +34,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Prerequisites run: .\build\vsts-prerequisites.ps1 shell: powershell From 5388bc462ee3db04ef7235da84eb4351d2d91a89 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 11:47:19 +0200 Subject: [PATCH 04/14] make template module agnostic --- .github/workflows/tmpl-build-release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 5e8bd8a5..232026b1 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -8,6 +8,10 @@ on: workflow_call: inputs: + module: + description: "The name of the module to build and release" + required: true + type: string autoversion: description: "Determines if the module's build version number is automatically incremented" default: $True @@ -48,7 +52,7 @@ jobs: - name: Get version run: | $publishDir = Get-Item -Path publish - [version]$version = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\d365bap.tools\d365bap.tools.psd1").ModuleVersion + [version]$version = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\${{ inputs.module }}\${{ inputs.module }}.psd1").ModuleVersion $githubReleaseVersion = "$($version.Major).$($version.Minor).$($version.Build)" "VERSION=$githubReleaseVersion" >> $env:GITHUB_ENV shell: powershell From 4888cba6e056d9207bf234ced96f7901924f97c1 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 11:50:36 +0200 Subject: [PATCH 05/14] add automatic versioning, skipping publishing and making script module agnostic --- build/vsts-build.ps1 | 50 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/build/vsts-build.ps1 b/build/vsts-build.ps1 index 8de872dc..932478db 100644 --- a/build/vsts-build.ps1 +++ b/build/vsts-build.ps1 @@ -5,23 +5,33 @@ It expects as input an ApiKey authorized to publish the module. Insert any build steps you may need to take before publishing it here. #> param ( - $ApiKey + $ModuleName = 'd365fo.tools', + + $Repository = 'PSGallery', + + $ApiKey, + + [switch] + $SkipPublish, + + [switch] + $AutoVersion ) # Prepare publish folder Write-PSFMessage -Level Important -Message "Creating and populating publishing directory" $publishDir = New-Item -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -Name publish -ItemType Directory -Copy-Item -Path "$($env:SYSTEM_DEFAULTWORKINGDIRECTORY)\d365fo.tools" -Destination $publishDir.FullName -Recurse -Force +Copy-Item -Path "$($env:SYSTEM_DEFAULTWORKINGDIRECTORY)\$ModuleName" -Destination $publishDir.FullName -Recurse -Force # Create commands.ps1 $text = @() -Get-ChildItem -Path "$($publishDir.FullName)\d365fo.tools\internal\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object { +Get-ChildItem -Path "$($publishDir.FullName)\$ModuleName\internal\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object { $text += [System.IO.File]::ReadAllText($_.FullName) } -Get-ChildItem -Path "$($publishDir.FullName)\d365fo.tools\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object { +Get-ChildItem -Path "$($publishDir.FullName)\$ModuleName\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object { $text += [System.IO.File]::ReadAllText($_.FullName) } -$text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\d365fo.tools\commands.ps1" +$text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\$ModuleName\commands.ps1" # Create resourcesBefore.ps1 $processed = @() @@ -30,7 +40,7 @@ foreach ($line in (Get-Content "$($PSScriptRoot)\filesBefore.txt" | Where-Object { if ([string]::IsNullOrWhiteSpace($line)) { continue } - $basePath = Join-Path "$($publishDir.FullName)\d365fo.tools" $line + $basePath = Join-Path "$($publishDir.FullName)\$ModuleName" $line foreach ($entry in (Resolve-PSFPath -Path $basePath)) { $item = Get-Item $entry @@ -40,7 +50,7 @@ foreach ($line in (Get-Content "$($PSScriptRoot)\filesBefore.txt" | Where-Object $processed += $item.FullName } } -if ($text) { $text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\d365fo.tools\resourcesBefore.ps1" } +if ($text) { $text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\$ModuleName\resourcesBefore.ps1" } # Create resourcesAfter.ps1 $processed = @() @@ -49,7 +59,7 @@ foreach ($line in (Get-Content "$($PSScriptRoot)\filesAfter.txt" | Where-Object { if ([string]::IsNullOrWhiteSpace($line)) { continue } - $basePath = Join-Path "$($publishDir.FullName)\d365fo.tools" $line + $basePath = Join-Path "$($publishDir.FullName)\$ModuleName" $line foreach ($entry in (Resolve-PSFPath -Path $basePath)) { $item = Get-Item $entry @@ -59,7 +69,27 @@ foreach ($line in (Get-Content "$($PSScriptRoot)\filesAfter.txt" | Where-Object $processed += $item.FullName } } -if ($text) { $text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\d365fo.tools\resourcesAfter.ps1" } +if ($text) { $text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\$ModuleName\resourcesAfter.ps1" } + +#region Updating the Module Version +if ($AutoVersion) +{ + Write-PSFMessage -Level Important -Message "Updating module version numbers." + try { [version]$remoteVersion = (Find-Module $ModuleName -Repository $Repository -ErrorAction Stop).Version } + catch + { + Stop-PSFFunction -Message "Failed to access $Repository" -EnableException $true -ErrorRecord $_ + } + if (-not $remoteVersion) + { + Stop-PSFFunction -Message "Couldn't find $ModuleName on repository $Repository" -EnableException $true + } + $newBuildNumber = $remoteVersion.Build + 1 + [version]$localVersion = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\$ModuleName\$ModuleName.psd1").ModuleVersion + Update-ModuleManifest -Path "$($publishDir.FullName)\$ModuleName\$ModuleName.psd1" -ModuleVersion "$($localVersion.Major).$($localVersion.Minor).$($newBuildNumber)" +} +#endregion Updating the Module Version # Publish to Gallery -Publish-Module -Path "$($publishDir.FullName)\d365fo.tools" -NuGetApiKey $ApiKey -Force \ No newline at end of file +if ($SkipPublish) { return } +Publish-Module -Path "$($publishDir.FullName)\$ModuleName" -NuGetApiKey $ApiKey -Force \ No newline at end of file From 1a0c81171c8080e60c7e2b5092b5822db60751e6 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 11:54:06 +0200 Subject: [PATCH 06/14] add module input --- .github/workflows/build-manual.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml index 4b9f48ff..bdba2ecc 100644 --- a/.github/workflows/build-manual.yml +++ b/.github/workflows/build-manual.yml @@ -22,6 +22,7 @@ jobs: call-tmpl-build-release: uses: ./.github/workflows/tmpl-build-release.yml with: + module: 'd365fo.tools' skippublish: ${{ inputs.skippublish }} skipghrelease: ${{ inputs.skipghrelease }} secrets: From e32bc703d76fb199129ce9ecf97b857be0d07a98 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 12:42:26 +0200 Subject: [PATCH 07/14] add working directory defaults --- build/vsts-build.ps1 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build/vsts-build.ps1 b/build/vsts-build.ps1 index 932478db..b00c2343 100644 --- a/build/vsts-build.ps1 +++ b/build/vsts-build.ps1 @@ -9,6 +9,8 @@ param ( $Repository = 'PSGallery', + $WorkingDirectory, + $ApiKey, [switch] @@ -18,10 +20,22 @@ param ( $AutoVersion ) +#region Handle Working Directory Defaults +if (-not $WorkingDirectory) +{ + if ($env:RELEASE_PRIMARYARTIFACTSOURCEALIAS) + { + $WorkingDirectory = Join-Path -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -ChildPath $env:RELEASE_PRIMARYARTIFACTSOURCEALIAS + } + else { $WorkingDirectory = $env:SYSTEM_DEFAULTWORKINGDIRECTORY } +} +if (-not $WorkingDirectory) { $WorkingDirectory = Split-Path $PSScriptRoot } +#endregion Handle Working Directory Defaults + # Prepare publish folder Write-PSFMessage -Level Important -Message "Creating and populating publishing directory" -$publishDir = New-Item -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -Name publish -ItemType Directory -Copy-Item -Path "$($env:SYSTEM_DEFAULTWORKINGDIRECTORY)\$ModuleName" -Destination $publishDir.FullName -Recurse -Force +$publishDir = New-Item -Path $WorkingDirectory -Name publish -ItemType Directory +Copy-Item -Path "$WorkingDirectory\$ModuleName" -Destination $publishDir.FullName -Recurse -Force # Create commands.ps1 $text = @() From 6b46e32cbb454c4a1068a15ea13c7cbd9a177ed7 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 12:49:05 +0200 Subject: [PATCH 08/14] add skipValidation option --- .github/workflows/build-manual.yml | 6 ++++++ .github/workflows/tmpl-build-release.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml index bdba2ecc..8b561369 100644 --- a/.github/workflows/build-manual.yml +++ b/.github/workflows/build-manual.yml @@ -17,6 +17,11 @@ on: options: - $False - $True + skipValidation: + description: "Determines if the module is validated before building" + default: false + required: false + type: boolean jobs: call-tmpl-build-release: @@ -25,5 +30,6 @@ jobs: module: 'd365fo.tools' skippublish: ${{ inputs.skippublish }} skipghrelease: ${{ inputs.skipghrelease }} + skipValidation: ${{ inputs.skipValidation }} secrets: apikey: ${{ secrets.ApiKey }} \ No newline at end of file diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 232026b1..8047fc8c 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -27,6 +27,11 @@ on: default: $False required: false type: string + skipValidation: + description: "Determines if the module is validated before building" + default: false + required: false + type: boolean secrets: apikey: description: "Key for the PowerShell Gallery API" @@ -45,6 +50,7 @@ jobs: - name: Validate run: .\build\vsts-validate.ps1 shell: powershell + if: ${{ inputs.skipValidation }} == false - name: Build run: .\build\vsts-build.ps1 -ApiKey ${{ secrets.apikey }} -AutoVersion:${{ inputs.autoversion }} -SkipPublish:${{ inputs.skippublish }} shell: powershell From 405efb362af3004bde75ab3b9bfa9d7dd7f1fbe4 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 12:53:43 +0200 Subject: [PATCH 09/14] update skipValidation description for clarity --- .github/workflows/build-manual.yml | 2 +- .github/workflows/tmpl-build-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml index 8b561369..2a3b1712 100644 --- a/.github/workflows/build-manual.yml +++ b/.github/workflows/build-manual.yml @@ -18,7 +18,7 @@ on: - $False - $True skipValidation: - description: "Determines if the module is validated before building" + description: "Determines if the module validation is skipped" default: false required: false type: boolean diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 8047fc8c..06a0d0de 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -28,7 +28,7 @@ on: required: false type: string skipValidation: - description: "Determines if the module is validated before building" + description: "Determines if the module validation is skipped" default: false required: false type: boolean From 64b479f05c512c901746ff83bd7dae374caa4f0f Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 13:04:41 +0200 Subject: [PATCH 10/14] fix if condition for skipping validation step --- .github/workflows/tmpl-build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 06a0d0de..362adf4e 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -50,7 +50,7 @@ jobs: - name: Validate run: .\build\vsts-validate.ps1 shell: powershell - if: ${{ inputs.skipValidation }} == false + if: ${{ ! inputs.skipValidation }} - name: Build run: .\build\vsts-build.ps1 -ApiKey ${{ secrets.apikey }} -AutoVersion:${{ inputs.autoversion }} -SkipPublish:${{ inputs.skippublish }} shell: powershell From d3e6deac1799f882c8caf1bd10da871c08c46248 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 13:09:46 +0200 Subject: [PATCH 11/14] actually use the skip Github release option --- .github/workflows/tmpl-build-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 362adf4e..325bb24a 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -65,6 +65,7 @@ jobs: - name: Create GitHub release uses: softprops/action-gh-release@v2 + if: ${{ ! inputs.skipghrelease }} with: name: ${{ env.VERSION }} tag_name: ${{ env.VERSION }} From bbe76f24a045cbc38fe8780bbcc96a734edea7b0 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 13:28:49 +0200 Subject: [PATCH 12/14] improve conditions --- .github/workflows/build-manual.yml | 7 ++----- .github/workflows/tmpl-build-release.yml | 9 +++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml index 2a3b1712..d7f6123c 100644 --- a/.github/workflows/build-manual.yml +++ b/.github/workflows/build-manual.yml @@ -11,12 +11,9 @@ on: - $True skipghrelease: description: "Determines if creation of a GitHub release is skipped" - default: $False + default: false required: false - type: choice - options: - - $False - - $True + type: boolean skipValidation: description: "Determines if the module validation is skipped" default: false diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml index 325bb24a..b939b948 100644 --- a/.github/workflows/tmpl-build-release.yml +++ b/.github/workflows/tmpl-build-release.yml @@ -24,9 +24,9 @@ on: type: string skipghrelease: description: "Determines if a GitHub release is created" - default: $False + default: false required: false - type: string + type: boolean skipValidation: description: "Determines if the module validation is skipped" default: false @@ -50,7 +50,7 @@ jobs: - name: Validate run: .\build\vsts-validate.ps1 shell: powershell - if: ${{ ! inputs.skipValidation }} + if: ${{ success() && ! inputs.skipValidation }} - name: Build run: .\build\vsts-build.ps1 -ApiKey ${{ secrets.apikey }} -AutoVersion:${{ inputs.autoversion }} -SkipPublish:${{ inputs.skippublish }} shell: powershell @@ -62,10 +62,11 @@ jobs: $githubReleaseVersion = "$($version.Major).$($version.Minor).$($version.Build)" "VERSION=$githubReleaseVersion" >> $env:GITHUB_ENV shell: powershell + if: ${{ success() && ! inputs.skipghrelease }} - name: Create GitHub release uses: softprops/action-gh-release@v2 - if: ${{ ! inputs.skipghrelease }} + if: ${{ success() && ! inputs.skipghrelease }} with: name: ${{ env.VERSION }} tag_name: ${{ env.VERSION }} From 93e2b179e87384adf40f3c9784570edd1487e1d5 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 13:34:15 +0200 Subject: [PATCH 13/14] use reusable workflow from alm repo --- .github/workflows/build-manual.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml index d7f6123c..548ac63b 100644 --- a/.github/workflows/build-manual.yml +++ b/.github/workflows/build-manual.yml @@ -22,7 +22,7 @@ on: jobs: call-tmpl-build-release: - uses: ./.github/workflows/tmpl-build-release.yml + uses: fh-inway/d365.psmodule-alm/.github/workflows/tmpl-build-release.yml@main with: module: 'd365fo.tools' skippublish: ${{ inputs.skippublish }} From afd2e7185f22e397fbd6ace86ca9ea5efd7a3c79 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 4 May 2024 13:41:28 +0200 Subject: [PATCH 14/14] remove obsolete reusable workflow --- .github/workflows/tmpl-build-release.yml | 75 ------------------------ 1 file changed, 75 deletions(-) delete mode 100644 .github/workflows/tmpl-build-release.yml diff --git a/.github/workflows/tmpl-build-release.yml b/.github/workflows/tmpl-build-release.yml deleted file mode 100644 index b939b948..00000000 --- a/.github/workflows/tmpl-build-release.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Template for a reusable workflow to build and release a PowerShell module. -# The template expects the following PowerShell scripts in the build folder of the repository root -# that do the actual validated build and release: -# - vsts-prerequisities.ps1 -# - vsts-validate.ps1 -# - vsts-build.ps1 - -on: - workflow_call: - inputs: - module: - description: "The name of the module to build and release" - required: true - type: string - autoversion: - description: "Determines if the module's build version number is automatically incremented" - default: $True - required: false - type: string - skippublish: - description: "Determines if the publishing to the PowerShell Gallery is skipped" - default: $False - required: false - type: string - skipghrelease: - description: "Determines if a GitHub release is created" - default: false - required: false - type: boolean - skipValidation: - description: "Determines if the module validation is skipped" - default: false - required: false - type: boolean - secrets: - apikey: - description: "Key for the PowerShell Gallery API" - required: true - -jobs: - build-and-release: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - - name: Install Prerequisites - run: .\build\vsts-prerequisites.ps1 - shell: powershell - - name: Validate - run: .\build\vsts-validate.ps1 - shell: powershell - if: ${{ success() && ! inputs.skipValidation }} - - name: Build - run: .\build\vsts-build.ps1 -ApiKey ${{ secrets.apikey }} -AutoVersion:${{ inputs.autoversion }} -SkipPublish:${{ inputs.skippublish }} - shell: powershell - - - name: Get version - run: | - $publishDir = Get-Item -Path publish - [version]$version = (Import-PowerShellDataFile -Path "$($publishDir.FullName)\${{ inputs.module }}\${{ inputs.module }}.psd1").ModuleVersion - $githubReleaseVersion = "$($version.Major).$($version.Minor).$($version.Build)" - "VERSION=$githubReleaseVersion" >> $env:GITHUB_ENV - shell: powershell - if: ${{ success() && ! inputs.skipghrelease }} - - - name: Create GitHub release - uses: softprops/action-gh-release@v2 - if: ${{ success() && ! inputs.skipghrelease }} - with: - name: ${{ env.VERSION }} - tag_name: ${{ env.VERSION }} - draft: false - prerelease: true - generate_release_notes: true \ No newline at end of file