Skip to content

Commit 19502ec

Browse files
🩹 [Patch]: Refactor Build-PSModule action to streamline input handling and update artifact paths
1 parent 0d98e7d commit 19502ec

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

‎action.yml‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,18 @@ runs:
4040
uses: PSModule/Install-PSModuleHelpers@v1
4141

4242
- name: Run Build-PSModule
43-
uses: PSModule/GitHub-Script@v1
43+
shell: pwsh
4444
id: build
4545
env:
4646
PSMODULE_BUILD_PSMODULE_INPUT_Name: ${{ inputs.Name }}
47-
with:
48-
Debug: ${{ inputs.Debug }}
49-
Prerelease: ${{ inputs.Prerelease }}
50-
Verbose: ${{ inputs.Verbose }}
51-
Version: ${{ inputs.Version }}
52-
WorkingDirectory: ${{ inputs.WorkingDirectory }}
53-
Script: |
54-
# Build-PSModule
55-
${{ github.action_path }}/scripts/main.ps1
47+
run: |
48+
# Build-PSModule
49+
${{ github.action_path }}/scripts/main.ps1
5650
5751
- name: Upload module artifact
5852
uses: actions/upload-artifact@v4
5953
with:
6054
name: ${{ inputs.ArtifactName }}
61-
path: ${{ fromJson(steps.build.outputs.result).moduleOutputFolderPath }}
55+
path: ${{ steps.build.outputs.ModuleOutputFolderPath }}
6256
if-no-files-found: error
6357
retention-days: 1

‎scripts/helpers/Build/Build-PSModuleManifest.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@
387387
#>
388388

389389
Write-Host '[LicenseUri]'
390-
$licenseUri = "https://github.com/$env:GITHUB_REPOSITORY_OWNER/$env:GITHUB_REPOSITORY_NAME/blob/main/LICENSE"
390+
$licenseUri = "https://github.com/$env:GITHUB_REPOSITORY/blob/main/LICENSE"
391391
$manifest.LicenseUri = $PSData.Keys -contains 'LicenseUri' ? $null -ne $PSData.LicenseUri ? $PSData.LicenseUri : $licenseUri : $licenseUri
392392
Write-Host "[LicenseUri] - [$($manifest.LicenseUri)]"
393393
if ([string]::IsNullOrEmpty($manifest.LicenseUri)) {
@@ -403,7 +403,7 @@
403403
}
404404

405405
Write-Host '[IconUri]'
406-
$iconUri = "https://raw.githubusercontent.com/$env:GITHUB_REPOSITORY_OWNER/$env:GITHUB_REPOSITORY_NAME/main/icon/icon.png"
406+
$iconUri = "https://raw.githubusercontent.com/$env:GITHUB_REPOSITORY/main/icon/icon.png"
407407
$manifest.IconUri = $PSData.Keys -contains 'IconUri' ? $null -ne $PSData.IconUri ? $PSData.IconUri : $iconUri : $iconUri
408408
Write-Host "[IconUri] - [$($manifest.IconUri)]"
409409
if ([string]::IsNullOrEmpty($manifest.IconUri)) {

‎scripts/main.ps1‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ LogGroup "Loading helper scripts from [$path]" {
1313
}
1414
}
1515

16+
$env:GITHUB_REPOSITORY_NAME = $env:GITHUB_REPOSITORY -replace '.+/'
17+
1618
LogGroup 'Loading inputs' {
1719
$moduleName = if ([string]::IsNullOrEmpty($env:PSMODULE_BUILD_PSMODULE_INPUT_Name)) {
1820
$env:GITHUB_REPOSITORY_NAME
1921
} else {
2022
$env:PSMODULE_BUILD_PSMODULE_INPUT_Name
2123
}
22-
Set-GitHubOutput -Name ModuleName -Value $moduleName
23-
2424
$sourceFolderPath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
2525
$moduleOutputFolderPath = Join-Path $pwd -ChildPath 'outputs/module'
2626
[pscustomobject]@{
@@ -50,6 +50,6 @@ $params = @{
5050
}
5151
Build-PSModule @params
5252

53-
Set-GithubOutput -Name ModuleOutputFolderPath -Value $moduleOutputFolderPath
53+
"ModuleOutputFolderPath=$moduleOutputFolderPath" >> $env:GITHUB_OUTPUT
5454

5555
exit 0

0 commit comments

Comments
 (0)