Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .build/scripts/Build-PSModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ function Build-PSModule {
# Compile to nupkg (run in isolated scope to suppress all output)
$savedGlobalVerbose = $global:VerbosePreference

# Compress to zip
$zipOutputPath = "$outputPath\$moduleName.zip"
Compress-Archive -Path $outputModulePath -DestinationPath $zipOutputPath -Verbose:$false

$nupkgOutputPath = & {
$VerbosePreference = 'SilentlyContinue'
$global:VerbosePreference = 'SilentlyContinue'
Expand All @@ -169,6 +173,13 @@ function Build-PSModule {

$global:VerbosePreference = $savedGlobalVerbose

# Hashes
$algorithm = 'sha256'
$zipOutputPath, $nupkgOutputPath | foreach {
$hash = (Get-FileHash -Path $_ -Algorithm $algorithm).Hash
Set-Content -Path "$_.$algorithm" -Value $hash -NoNewline -Encoding utf8
}

Write-Verbose "Module built successfully to: $nupkgOutputPath"
}

Expand Down
16 changes: 12 additions & 4 deletions .build/scripts/Publish-GitHubModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,20 @@ function Publish-GitHubModule {
Write-Verbose "Package URL: https://github.com/$Owner/$Repository/packages"

# Set environment variables for release
"module_name=$ModuleName" | Out-File -FilePath $env:GITHUB_ENV -Append
"module_name=$moduleName" | Out-File -FilePath $env:GITHUB_ENV -Append
"module_version=$version" | Out-File -FilePath $env:GITHUB_ENV -Append

$nupkgHash = (Get-FileHash -Path $nupkgFile.FullName -Algorithm SHA256).Hash
"nupkg_hash=$nupkgHash" | Out-File -FilePath $env:GITHUB_ENV -Append
"nupkg_name=$($nupkgFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append
$nupkgRelPath = ".output/$moduleName.$version.nupkg"
$zipRelPath = ".output/$moduleName.zip"
$algorithm = 'sha256'
$nupkgHashPath, $zipHashPath = $nupkgRelPath, $zipRelPath | foreach {
"$_.$algorithm"
}

"nupkg_path=$nupkgRelPath" | Out-File -FilePath $env:GITHUB_ENV -Append
"zip_path=$zipRelPath" | Out-File -FilePath $env:GITHUB_ENV -Append
"nupkg_hash_path=$nupkgHashPath" | Out-File -FilePath $env:GITHUB_ENV -Append
"zip_hash_path=$zipHashPath" | Out-File -FilePath $env:GITHUB_ENV -Append
}
finally {
# Clean up - remove the source
Expand Down
228 changes: 0 additions & 228 deletions .build/scripts/Publish-PSGalleryModule.ps1

This file was deleted.

9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ jobs:
# Install the module
Install-PSResource -Name '${{ env.module_name }}' -Repository GitHub -Version ${{ env.module_version }} -Credential $githubCredential
```

### Hashes (Sha256)
* **${{ env.nupkg_name }}** - ${{ env.nupkg_hash }}
---
*This release was automatically generated by GitHub Actions*
files:
${{ env.nupkg_path }}
${{ env.nupkg_hash_path }}
${{ env.zip_path }}
${{ env.zip_hash_path }}
docs/*.md
Loading