mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-07-26 07:58:14 +00:00
aff2ffc752
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
114 lines
3.6 KiB
YAML
114 lines
3.6 KiB
YAML
name: Publish to PSGallery
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- name: Build module
|
|
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --output ./publish/netstandard2.0
|
|
|
|
- name: Clean publish output
|
|
run: rm -f ./publish/netstandard2.0/*.deps.json ./publish/netstandard2.0/*.runtimeconfig.json
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: module-netstandard2.0
|
|
path: ./publish/netstandard2.0/
|
|
|
|
smoke-test-ps51:
|
|
needs: build
|
|
runs-on: windows-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Download module artifact
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: module-netstandard2.0
|
|
path: ./publish/netstandard2.0/
|
|
|
|
- name: Import module on Windows PowerShell 5.1
|
|
shell: powershell
|
|
run: |
|
|
$modulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\PSProxmoxVE"
|
|
New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
|
|
Copy-Item -Path .\publish\netstandard2.0\* -Destination $modulePath -Recurse -Force
|
|
Import-Module PSProxmoxVE -Force -ErrorAction Stop
|
|
$commands = Get-Command -Module PSProxmoxVE
|
|
Write-Host "PS 5.1 smoke test: module loaded with $($commands.Count) commands"
|
|
if ($commands.Count -lt 150) {
|
|
throw "Expected at least 150 commands, got $($commands.Count)"
|
|
}
|
|
|
|
publish:
|
|
needs: [build, smoke-test-ps51]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Download module artifact
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: module-netstandard2.0
|
|
path: ./publish/PSProxmoxVE/
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Update module version in manifest
|
|
shell: pwsh
|
|
run: |
|
|
$manifestPath = './publish/PSProxmoxVE/PSProxmoxVE.psd1'
|
|
$version = '${{ steps.version.outputs.version }}'
|
|
# Strip prerelease suffix for ModuleVersion (must be X.Y.Z)
|
|
$moduleVersion = ($version -split '-')[0]
|
|
$content = Get-Content $manifestPath -Raw
|
|
$content = $content -replace "ModuleVersion\s*=\s*'[^']*'", "ModuleVersion = '$moduleVersion'"
|
|
Set-Content $manifestPath $content
|
|
|
|
- name: Test module loads on PS 7.x
|
|
shell: pwsh
|
|
run: |
|
|
$modulePath = "$HOME/.local/share/powershell/Modules/PSProxmoxVE"
|
|
New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
|
|
Copy-Item -Path ./publish/PSProxmoxVE/* -Destination $modulePath -Recurse -Force
|
|
Import-Module PSProxmoxVE -Force -ErrorAction Stop
|
|
$commands = Get-Command -Module PSProxmoxVE
|
|
Write-Host "Module loaded with $($commands.Count) commands"
|
|
if ($commands.Count -lt 150) {
|
|
throw "Expected at least 150 commands, got $($commands.Count)"
|
|
}
|
|
|
|
- name: Publish to PSGallery
|
|
shell: pwsh
|
|
env:
|
|
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
|
run: |
|
|
Publish-Module -Path ./publish/PSProxmoxVE -NuGetApiKey $env:NUGET_API_KEY -Verbose
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
generate_release_notes: true
|