|
70 | 70 | env: |
71 | 71 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
72 | 72 |
|
73 | | - - name: Setup PowerShell module cache |
74 | | - id: cacher |
75 | | - uses: actions/cache@v3 |
76 | | - with: |
77 | | - path: "~/.local/share/powershell/Modules" |
78 | | - key: ${{ runner.os }}-ModuleBuilder |
79 | | - |
80 | | - - name: Install ModuleBuilder |
81 | | - if: steps.cacher.outputs.cache-hit != 'true' |
82 | | - shell: pwsh |
83 | | - run: | |
84 | | - Set-PSRepository PSGallery -InstallationPolicy Trusted |
85 | | - Install-Module ModuleBuilder -AllowClobber -Force |
86 | | -
|
87 | | - - name: Build CIPPCore Module |
88 | | - shell: pwsh |
89 | | - run: | |
90 | | - $ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CIPPCore" |
91 | | - $OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output" |
92 | | -
|
93 | | - Write-Host "Building module from: $ModulePath" |
94 | | - Write-Host "Output directory: $OutputPath" |
95 | | -
|
96 | | - # Generate function permissions before replacing the source module |
97 | | - $ToolsPath = Join-Path $env:GITHUB_WORKSPACE "Tools" |
98 | | - $ScriptPath = Join-Path $ToolsPath "Build-FunctionPermissions.ps1" |
99 | | - pwsh -File $ScriptPath -ModulePath $ModulePath |
100 | | -
|
101 | | - # Build the module using ModuleBuilder |
102 | | - Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose |
103 | | -
|
104 | | - # Replace the source module with the built module |
105 | | - Remove-Item -Path $ModulePath -Recurse -Force |
106 | | - Copy-Item -Path (Join-Path $OutputPath "CIPPCore") -Destination $ModulePath -Recurse -Force |
107 | | -
|
108 | | - Write-Host "Module built and replaced successfully" |
109 | | -
|
110 | | - # Clean up output directory |
111 | | - Remove-Item -Path $OutputPath -Recurse -Force |
112 | | -
|
113 | | - - name: Build CippExtensions Module |
114 | | - shell: pwsh |
115 | | - run: | |
116 | | - $ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CippExtensions" |
117 | | - $OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output" |
118 | | -
|
119 | | - Write-Host "Building module from: $ModulePath" |
120 | | - Write-Host "Output directory: $OutputPath" |
121 | | -
|
122 | | - # Build the module using ModuleBuilder |
123 | | - Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose |
124 | | -
|
125 | | - # Replace the source module with the built module |
126 | | - Remove-Item -Path $ModulePath -Recurse -Force |
127 | | - Copy-Item -Path (Join-Path $OutputPath "CippExtensions") -Destination $ModulePath -Recurse -Force |
128 | | -
|
129 | | - Write-Host "Module built and replaced successfully" |
130 | | -
|
131 | | - # Clean up output directory |
132 | | - Remove-Item -Path $OutputPath -Recurse -Force |
133 | | -
|
134 | | -
|
135 | 73 | # Create ZIP File in a New Source Directory |
136 | 74 | - name: Prepare and Zip Release Files |
137 | 75 | if: env.tag_exists == 'false' |
|
0 commit comments