Skip to content

Commit c9bcc51

Browse files
committed
Update build and release pipeline
1 parent 820ac1a commit c9bcc51

25 files changed

+364
-1227
lines changed

.config/tsaoptions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"instanceUrl": "https://msazure.visualstudio.com",
3+
"projectName": "One",
4+
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell\\PowerShell Core",
5+
"notificationAliases": [
6+
"andschwa@microsoft.com",
7+
"slee@microsoft.com"
8+
],
9+
"codebaseName": "PSDSC_202502"
10+
}

.github/workflows/ci-test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ v2 ]
6+
pull_request:
7+
branches: [ v2 ]
8+
9+
jobs:
10+
ci:
11+
name: pester
12+
runs-on: windows-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Install PSResources
18+
run: ./tools/installPSResources.ps1
19+
shell: pwsh
20+
21+
- name: Build
22+
run: ./build.ps1 -Build
23+
shell: pwsh
24+
25+
- name: Test
26+
run: ./build.ps1 -Test
27+
shell: pwsh
28+
29+
- name: Test Windows PowerShell
30+
run: |
31+
Install-Module Pester -Scope CurrentUser -Force -SkipPublisherCheck
32+
./build.ps1 -Test
33+
shell: powershell
34+
35+
- name: Package
36+
run: ./build.ps1 -Publish
37+
shell: pwsh
38+
39+
- name: Upload build artifacts
40+
uses: actions/upload-artifact@v4
41+
if: always()
42+
with:
43+
name: PSDesiredStateConfiguration-package
44+
path: out/**/*.nupkg
45+
46+
- name: Upload test results
47+
uses: actions/upload-artifact@v4
48+
if: always()
49+
with:
50+
name: PSDesiredStateConfiguration-tests
51+
path: out/testResults.xml
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
trigger:
2+
- main
3+
4+
schedules:
5+
- cron: '18 11 * * 5'
6+
displayName: Weekly CodeQL
7+
branches:
8+
include:
9+
- main
10+
always: true
11+
12+
parameters:
13+
- name: debug
14+
displayName: Enable debug output
15+
type: boolean
16+
default: false
17+
- name: OfficialBuild
18+
displayName: Use Official OneBranch template
19+
type: boolean
20+
default: true
21+
- name: Release
22+
displayName: Generate a release
23+
type: boolean
24+
default: false
25+
26+
variables:
27+
system.debug: ${{ parameters.debug }}
28+
BuildConfiguration: Release
29+
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
30+
OneBranchTemplate: ${{ iif(parameters.OfficialBuild, 'v2/OneBranch.Official.CrossPlat.yml@templates', 'v2/OneBranch.NonOfficial.CrossPlat.yml@templates') }}
31+
32+
resources:
33+
repositories:
34+
- repository: templates
35+
type: git
36+
name: OneBranch.Pipelines/GovernedTemplates
37+
ref: refs/heads/main
38+
39+
extends:
40+
# https://aka.ms/obpipelines/templates
41+
template: ${{ variables.OneBranchTemplate }}
42+
parameters:
43+
globalSdl: # https://aka.ms/obpipelines/sdl
44+
asyncSdl:
45+
enabled: true
46+
forStages: [build]
47+
featureFlags:
48+
EnableCDPxPAT: false
49+
WindowsHostVersion:
50+
Version: 2022
51+
Network: KS3
52+
release:
53+
category: NonAzure
54+
stages:
55+
- stage: build
56+
jobs:
57+
- job: main
58+
displayName: Build package
59+
pool:
60+
type: windows
61+
variables:
62+
ob_outputDirectory: $(Build.SourcesDirectory)/out
63+
steps:
64+
- pwsh: |
65+
$manifest = Import-PowerShellDataFile ./src/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1
66+
$version = $manifest.ModuleVersion
67+
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
68+
name: package
69+
displayName: Get version from module manifest
70+
- task: onebranch.pipeline.version@1
71+
displayName: Set OneBranch version
72+
inputs:
73+
system: Custom
74+
customVersion: $(package.version)
75+
- pwsh: ./tools/installPSResources.ps1 -PSRepository CFS
76+
displayName: Install PSResources
77+
- pwsh: ./build.ps1 -Clean -Build -Test
78+
displayName: Build
79+
- task: onebranch.pipeline.signing@1
80+
displayName: Sign 1st-party files
81+
inputs:
82+
command: sign
83+
signing_profile: external_distribution
84+
search_root: $(Build.SourcesDirectory)/out
85+
files_to_sign: |
86+
**/*.psd1;
87+
**/*.psm1;
88+
- pwsh: ./build.ps1 -Publish
89+
displayName: Package module
90+
- task: onebranch.pipeline.signing@1
91+
displayName: Sign NuGet package
92+
inputs:
93+
command: sign
94+
signing_profile: external_distribution
95+
search_root: $(Build.SourcesDirectory)/out
96+
files_to_sign: |
97+
*.nupkg
98+
- stage: release
99+
dependsOn: build
100+
condition: and(succeeded(), ${{ eq(parameters.Release, true) }})
101+
variables:
102+
ob_release_environment: ${{ iif(parameters.OfficialBuild, 'Production', 'Test') }}
103+
version: $[ stageDependencies.build.main.outputs['package.version'] ]
104+
jobs:
105+
- job: github
106+
displayName: Publish draft to GitHub
107+
pool:
108+
type: release
109+
templateContext:
110+
inputs:
111+
- input: pipelineArtifact
112+
artifactName: drop_build_main
113+
steps:
114+
- task: GitHubRelease@1
115+
displayName: Create GitHub release
116+
inputs:
117+
gitHubConnection: GitHub
118+
repositoryName: PowerShell/PSDesiredStateConfiguration
119+
target: main
120+
assets: $(Pipeline.Workspace)/PSDesiredStateConfiguration.$(version).nupkg
121+
tagSource: userSpecifiedTag
122+
tag: $(version)
123+
isDraft: true
124+
addChangeLog: false
125+
releaseNotesSource: inline
126+
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"
127+
- job: validation
128+
displayName: Manual validation
129+
pool:
130+
type: server
131+
timeoutInMinutes: 1440
132+
steps:
133+
- task: ManualValidation@0
134+
displayName: Wait 24 hours for validation
135+
inputs:
136+
notifyUsers: $(Build.RequestedForEmail)
137+
instructions: Please validate the release and then publish it!
138+
timeoutInMinutes: 1440
139+
- job: publish
140+
dependsOn: validation
141+
displayName: Publish to PowerShell Gallery
142+
pool:
143+
type: release
144+
templateContext:
145+
inputs:
146+
- input: pipelineArtifact
147+
artifactName: drop_build_main
148+
steps:
149+
- task: NuGetCommand@2
150+
displayName: Publish module to PowerShell Gallery
151+
inputs:
152+
command: push
153+
packagesToPush: $(Pipeline.Workspace)/PSDesiredStateConfiguration.$(version).nupkg
154+
nuGetFeedType: external
155+
publishFeedCredentials: PowerShellGallery

.vsts-ci/azure-pipelines-ci.yml

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)