Bump minor version to 24, improve local setup (undo-local) reliabilit… #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- ./*.ps1 | |
- '**.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- ./*.ps1 | |
- '**.md' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# - name: Install Winget | |
# shell: pwsh | |
# run: | | |
# if (-not (Get-Command winget -ErrorAction SilentlyContinue)) { | |
# Write-Host "winget not found, installing winget." | |
# $wingetInstaller = "$env:TEMP\winget.appxbundle" | |
# Invoke-WebRequest -Uri "https://aka.ms/getwinget" -OutFile $wingetInstaller | |
# Add-AppxPackage -Path $wingetInstaller | |
# # Refresh environment variables by appending typical install path | |
# $env:PATH += ";C:\Program Files\WindowsApps" | |
# } else { | |
# Write-Host "winget is already installed." | |
# } | |
- name: Install Pester | |
run: Install-Module -Name Pester -Force -SkipPublisherCheck | |
- name: Run Pester tests | |
run: | | |
$config = New-PesterConfiguration | |
$config.Run.Path = 'tests' | |
$config.TestResult.Enabled = $true | |
$config.CodeCoverage.Enabled = $true | |
Invoke-Pester -Configuration $config | |
shell: pwsh | |
continue-on-error: true | |
- name: Publish test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: ./testResults.xml | |
publish: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- name: Checkout for Release | |
uses: actions/checkout@v4 | |
- name: Publish to PowerShell Gallery | |
if: success() | |
shell: pwsh | |
env: | |
PSGalleryApiKey: ${{ secrets.PSGALLERY_API_KEY }} | |
run: | | |
.\Build.ps1 -Package -Analyze -patchVersion "${{ github.run_number }}${{ github.run_attempt }}" -NuGetApiKey $env:PSGalleryApiKey | |
- name: Get Module Version | |
if: success() | |
id: get_version | |
shell: pwsh | |
run: | | |
$manifestPath = "src/AzKube/AzKube.psd1" | |
$moduleInfo = Import-PowerShellDataFile -Path $manifestPath | |
$fullVersion = $moduleInfo.ModuleVersion | |
echo "version=$fullVersion" >> $env:GITHUB_OUTPUT | |
- name: Create GitHub Release | |
if: success() | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
$version = "${{ steps.get_version.outputs.version }}" | |
$tagName = "v$version" | |
$title = "Release v$version" | |
# Create release with auto-generated notes | |
gh release create $tagName ` | |
--generate-notes ` | |
--notes "Release of AzKube version $version`n`nThis release has been published to the PowerShell Gallery.`n" ` | |
--latest |