Skip to content

Merge pull request #1455 from maester365/auto-update-report-template-… #417

Merge pull request #1455 from maester365/auto-update-report-template-…

Merge pull request #1455 from maester365/auto-update-report-template-… #417

name: publish-module-preview
on:
push:
branches:
- main
paths:
- "powershell/**"
- "!powershell/Maester.psd1"
- "report/**"
workflow_dispatch:
permissions:
id-token: write
contents: write
checks: write
actions: read
pull-requests: write
statuses: write
jobs:
build-report:
uses: ./.github/workflows/build-report.yaml
create-preview-release:
needs: build-report
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Download updated report template
if: needs.build-report.outputs.report-updated == 'true'
uses: actions/download-artifact@v7
with:
name: updated-report-template
path: powershell/assets/
- name: Package ./tests to PowerShell module
id: package-tests
shell: pwsh
run: ./build/Copy-MaesterTestsToPSModule.ps1 -Force
- name: Set module version
id: moduleversion
shell: pwsh
run: ./.github/workflows/minor-version-update.ps1 -preview
- name: Archive PowerShell build
uses: actions/[email protected]
with:
name: maester-module
path: |
${{ github.workspace }}/powershell
- name: Update PowerShell Module to PowerShell Gallery
id: publish-to-gallery
shell: pwsh
run: |
# Copy to maester folder to avoid issues when publishing
Copy-Item ${{ github.workspace }}/powershell -Recurse -Destination ${{ github.workspace }}/maester/ -Force
Publish-Module -Path ${{ github.workspace }}/maester -NuGetApiKey ${{ secrets.PS_GALLERY_KEY }}
- name: Build PowerShell module for GitHub
id: module-creation
shell: pwsh
run: |
Compress-Archive -Path ${{ github.workspace }}/maester/* -DestinationPath ${{ github.workspace }}/maester.zip
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "maester.zip"
replacesArtifacts: true
allowUpdates: true
generateReleaseNotes: true
makeLatest: false
prerelease: true
tag: ${{ steps.moduleversion.outputs.tag }}
commit: ${{ github.sha }}