-
Notifications
You must be signed in to change notification settings - Fork 234
80 lines (68 loc) · 2.4 KB
/
publish-module-preview.yaml
File metadata and controls
80 lines (68 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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-maester-report-template.yaml
create-preview-release:
needs: build-report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download updated report template
if: needs.build-report.outputs.report-updated == 'true'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
with:
artifacts: "maester.zip"
replacesArtifacts: true
allowUpdates: true
generateReleaseNotes: true
makeLatest: false
prerelease: true
tag: ${{ steps.moduleversion.outputs.tag }}
commit: ${{ github.sha }}