|
26 | 26 | with: |
27 | 27 | persist-credentials: false |
28 | 28 |
|
29 | | - - name: Setup PowerShell module cache |
30 | | - id: cacher |
31 | | - uses: actions/cache@v3 |
32 | | - with: |
33 | | - path: "~/.local/share/powershell/Modules" |
34 | | - key: ${{ runner.os }}-ModuleBuilder |
35 | | - |
36 | | - - name: Install ModuleBuilder |
37 | | - if: steps.cacher.outputs.cache-hit != 'true' |
38 | | - shell: pwsh |
39 | | - run: | |
40 | | - Set-PSRepository PSGallery -InstallationPolicy Trusted |
41 | | - Install-Module ModuleBuilder -AllowClobber -Force |
42 | | -
|
43 | | - - name: Build CIPPCore Module |
44 | | - shell: pwsh |
45 | | - run: | |
46 | | - $ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CIPPCore" |
47 | | - $OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output" |
48 | | -
|
49 | | - Write-Host "Building module from: $ModulePath" |
50 | | - Write-Host "Output directory: $OutputPath" |
51 | | -
|
52 | | - # Build the module using ModuleBuilder |
53 | | - Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose |
54 | | -
|
55 | | - # Replace the source module with the built module |
56 | | - Remove-Item -Path $ModulePath -Recurse -Force |
57 | | - Copy-Item -Path (Join-Path $OutputPath "CIPPCore") -Destination $ModulePath -Recurse -Force |
58 | | -
|
59 | | - Write-Host "Module built and replaced successfully" |
60 | | -
|
61 | | - # Clean up output directory |
62 | | - Remove-Item -Path $OutputPath -Recurse -Force |
63 | | -
|
64 | | - - name: Build CippExtensions Module |
65 | | - shell: pwsh |
66 | | - run: | |
67 | | - $ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CippExtensions" |
68 | | - $OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output" |
69 | | -
|
70 | | - Write-Host "Building module from: $ModulePath" |
71 | | - Write-Host "Output directory: $OutputPath" |
72 | | -
|
73 | | - # Build the module using ModuleBuilder |
74 | | - Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose |
75 | | -
|
76 | | - # Replace the source module with the built module |
77 | | - Remove-Item -Path $ModulePath -Recurse -Force |
78 | | - Copy-Item -Path (Join-Path $OutputPath "CippExtensions") -Destination $ModulePath -Recurse -Force |
79 | | -
|
80 | | - Write-Host "Module built and replaced successfully" |
81 | | -
|
82 | | - # Clean up output directory |
83 | | - Remove-Item -Path $OutputPath -Recurse -Force |
84 | | -
|
85 | 29 | - name: Login to Azure |
86 | 30 | uses: azure/login@v2 |
87 | 31 | with: |
|
0 commit comments