Skip to content

Commit d2abc00

Browse files
Merge pull request #247 from PowerShell/OBP_Official_andschwa_fyprNM
Migrate build and publish system
2 parents 2e566d0 + 031531c commit d2abc00

35 files changed

+643
-1585
lines changed

.config/tsaoptions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"instanceUrl": "https://msazure.visualstudio.com",
3+
"projectName": "One",
4+
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell",
5+
"notificationAliases": [ "[email protected]", "[email protected]" ],
6+
"codebaseName": "PowerShell_ConsoleGuiTools_20240404",
7+
"tools": [ "CredScan", "PoliCheck", "BinSkim" ]
8+
}

.github/workflows/ci-test.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
merge_group:
9+
types: [ checks_requested ]
10+
11+
jobs:
12+
ci:
13+
name: dotnet
14+
strategy:
15+
matrix:
16+
os: [ windows-latest, macos-latest, ubuntu-latest ]
17+
runs-on: ${{ matrix.os }}
18+
env:
19+
DOTNET_NOLOGO: true
20+
DOTNET_CLI_TELEMETRY_OPTOUT: true
21+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install dotnet
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
cache: true
30+
cache-dependency-path: '**/*.csproj'
31+
32+
- name: Install PSResources
33+
shell: pwsh
34+
run: ./tools/installPSResources.ps1
35+
36+
- name: Build and test
37+
shell: pwsh
38+
run: Invoke-Build -Configuration Release Build, Package
39+
40+
- name: Upload module
41+
if: always()
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: ConsoleGuiTools-module-${{ matrix.os }}
45+
path: module
46+
47+
- name: Upload NuGet package
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: ConsoleGuiTools-nupkg-${{ matrix.os }}
51+
path: out/*.nupkg

.gitignore

+5-46
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,6 @@
1-
*.swp
2-
*.*~
3-
project.lock.json
4-
.DS_Store
5-
*.pyc
6-
nupkg/
7-
8-
# Rider
9-
.idea
10-
11-
# User-specific files
12-
*.suo
13-
*.user
14-
*.userosscache
15-
*.sln.docstates
16-
17-
# Build results
18-
[Dd]ebug/
19-
[Dd]ebugPublic/
20-
[Rr]elease/
21-
[Rr]eleases/
22-
x64/
23-
x86/
24-
build/
25-
bld/
26-
[Bb]in/
27-
[Oo]bj/
28-
[Oo]ut/
29-
msbuild.log
30-
msbuild.err
31-
msbuild.wrn
32-
33-
#Module build
341
module/
35-
36-
# Visual Studio 2015
37-
.vs/
38-
39-
# ingore downloaded .NET
40-
.dotnet
41-
42-
# Ignore package
43-
Microsoft.PowerShell.GraphicalTools.zip
44-
Microsoft.PowerShell.ConsoleGuiTools.zip
45-
46-
# git artifacts
47-
*.orig
2+
out/
3+
bin/
4+
obj/
5+
publish/
6+
*.sln
+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#################################################################################
2+
# OneBranch Pipelines #
3+
# This pipeline was created by EasyStart from a sample located at: #
4+
# https://aka.ms/obpipelines/easystart/samples #
5+
# Documentation: https://aka.ms/obpipelines #
6+
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
7+
# Retail Tasks: https://aka.ms/obpipelines/tasks #
8+
# Support: https://aka.ms/onebranchsup #
9+
#################################################################################
10+
11+
trigger: none
12+
13+
parameters:
14+
- name: debug
15+
displayName: Enable debug output
16+
type: boolean
17+
default: false
18+
19+
variables:
20+
system.debug: ${{ parameters.debug }}
21+
BuildConfiguration: Release
22+
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
23+
DOTNET_NOLOGO: true
24+
DOTNET_CLI_TELEMETRY_OPTOUT: true
25+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
26+
27+
resources:
28+
repositories:
29+
- repository: templates
30+
type: git
31+
name: OneBranch.Pipelines/GovernedTemplates
32+
ref: refs/heads/main
33+
34+
extends:
35+
# https://aka.ms/obpipelines/templates
36+
template: v2/OneBranch.Official.CrossPlat.yml@templates
37+
parameters:
38+
globalSdl: # https://aka.ms/obpipelines/sdl
39+
asyncSdl:
40+
enabled: true
41+
forStages: [build]
42+
stages:
43+
- stage: build
44+
jobs:
45+
- job: main
46+
displayName: Build package
47+
pool:
48+
type: windows
49+
variables:
50+
ob_outputDirectory: $(Build.SourcesDirectory)/out
51+
steps:
52+
- pwsh: |
53+
$data = Import-PowerShellDataFile -Path src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1
54+
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$($data.ModuleVersion)"
55+
name: package
56+
displayName: Get version from project properties
57+
- task: onebranch.pipeline.version@1
58+
displayName: Set OneBranch version
59+
inputs:
60+
system: Custom
61+
customVersion: $(package.version)
62+
- task: UseDotNet@2
63+
displayName: Use .NET SDK
64+
inputs:
65+
packageType: sdk
66+
useGlobalJson: true
67+
- task: PowerShell@2
68+
displayName: Install PSResources
69+
inputs:
70+
pwsh: true
71+
filePath: tools/installPSResources.ps1
72+
- pwsh: Invoke-Build -Configuration $(BuildConfiguration)
73+
displayName: Build
74+
- task: onebranch.pipeline.signing@1
75+
displayName: Sign 1st-party files
76+
inputs:
77+
command: sign
78+
signing_profile: external_distribution
79+
search_root: $(Build.SourcesDirectory)/module
80+
files_to_sign: |
81+
*.psd1;
82+
Microsoft.PowerShell.*.dll;
83+
- task: onebranch.pipeline.signing@1
84+
displayName: Sign 3rd-party files
85+
inputs:
86+
command: sign
87+
signing_profile: 135020002
88+
search_root: $(Build.SourcesDirectory)/module
89+
files_to_sign: |
90+
NStack.dll;
91+
Terminal.Gui.dll;
92+
- task: ArchiveFiles@2
93+
displayName: Zip module
94+
inputs:
95+
rootFolderOrFile: $(Build.SourcesDirectory)/module
96+
includeRootFolder: false
97+
archiveType: zip
98+
archiveFile: out/ConsoleGuiTools-v$(package.version).zip
99+
- pwsh: Invoke-Build -Configuration $(BuildConfiguration) Package
100+
displayName: Package module
101+
- task: onebranch.pipeline.signing@1
102+
displayName: Sign NuGet package
103+
inputs:
104+
command: sign
105+
signing_profile: external_distribution
106+
search_root: $(Build.SourcesDirectory)/out
107+
files_to_sign: "*.nupkg"
108+
- stage: release
109+
dependsOn: build
110+
variables:
111+
version: $[ stageDependencies.build.main.outputs['package.version'] ]
112+
drop: $(Pipeline.Workspace)/drop_build_main
113+
jobs:
114+
- job: github
115+
displayName: Publish draft to GitHub
116+
pool:
117+
type: windows
118+
variables:
119+
ob_outputDirectory: $(Build.SourcesDirectory)/out
120+
steps:
121+
- download: current
122+
displayName: Download artifacts
123+
- task: GitHubRelease@1
124+
displayName: Create GitHub release
125+
inputs:
126+
gitHubConnection: GitHub
127+
repositoryName: PowerShell/ConsoleGuiTools
128+
assets: |
129+
$(drop)/Microsoft.PowerShell.ConsoleGuiTools.$(version).nupkg
130+
$(drop)/ConsoleGuiTools-v$(version).zip
131+
tagSource: userSpecifiedTag
132+
tag: v$(version)
133+
isDraft: true
134+
addChangeLog: false
135+
releaseNotesSource: inline
136+
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"
137+
- job: validation
138+
displayName: Manual validation
139+
pool:
140+
type: agentless
141+
timeoutInMinutes: 1440
142+
steps:
143+
- task: ManualValidation@0
144+
displayName: Wait 24 hours for validation
145+
inputs:
146+
notifyUsers: $(Build.RequestedForEmail)
147+
instructions: Please validate the release and then publish it!
148+
timeoutInMinutes: 1440
149+
- job: publish
150+
dependsOn: validation
151+
displayName: Publish to PowerShell Gallery
152+
pool:
153+
type: windows
154+
variables:
155+
ob_outputDirectory: $(Build.SourcesDirectory)/out
156+
steps:
157+
- download: current
158+
displayName: Download artifacts
159+
- task: NuGetCommand@2
160+
displayName: Publish ConsoleGuiTools to PowerShell Gallery
161+
inputs:
162+
command: push
163+
packagesToPush: $(drop)/Microsoft.PowerShell.ConsoleGuiTools.$(version).nupkg
164+
publishFeedCredentials: PowerShellGallery

.vscode/launch.json

-32
This file was deleted.

.vscode/settings.json

-5
This file was deleted.

.vscode/tasks.json

-22
This file was deleted.

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

-31
This file was deleted.

0 commit comments

Comments
 (0)