Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate build and publish system #247

Merged
merged 9 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .config/tsaoptions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"instanceUrl": "https://msazure.visualstudio.com",
"projectName": "One",
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell",
"notificationAliases": [ "[email protected]", "[email protected]" ],
"codebaseName": "PowerShell_ConsoleGuiTools_20240404",
"tools": [ "CredScan", "PoliCheck", "BinSkim" ]
}
51 changes: 51 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
types: [ checks_requested ]

jobs:
ci:
name: dotnet
strategy:
matrix:
os: [ windows-latest, macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dotnet
uses: actions/setup-dotnet@v4
with:
cache: true
cache-dependency-path: '**/*.csproj'

- name: Install PSResources
shell: pwsh
run: ./tools/installPSResources.ps1

- name: Build and test
shell: pwsh
run: Invoke-Build -Configuration Release Build, Package

- name: Upload module
if: always()
uses: actions/upload-artifact@v4
with:
name: ConsoleGuiTools-module-${{ matrix.os }}
path: module

- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: ConsoleGuiTools-nupkg-${{ matrix.os }}
path: out/*.nupkg
51 changes: 5 additions & 46 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,6 @@
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/

# Rider
.idea

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn

#Module build
module/

# Visual Studio 2015
.vs/

# ingore downloaded .NET
.dotnet

# Ignore package
Microsoft.PowerShell.GraphicalTools.zip
Microsoft.PowerShell.ConsoleGuiTools.zip

# git artifacts
*.orig
out/
bin/
obj/
publish/
*.sln
164 changes: 164 additions & 0 deletions .pipelines/ConsoleGuiTools-Official.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#################################################################################
# OneBranch Pipelines #
# This pipeline was created by EasyStart from a sample located at: #
# https://aka.ms/obpipelines/easystart/samples #
# Documentation: https://aka.ms/obpipelines #
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
# Retail Tasks: https://aka.ms/obpipelines/tasks #
# Support: https://aka.ms/onebranchsup #
#################################################################################

trigger: none

parameters:
- name: debug
displayName: Enable debug output
type: boolean
default: false

variables:
system.debug: ${{ parameters.debug }}
BuildConfiguration: Release
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false

resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main

extends:
# https://aka.ms/obpipelines/templates
template: v2/OneBranch.Official.CrossPlat.yml@templates
parameters:
globalSdl: # https://aka.ms/obpipelines/sdl
asyncSdl:
enabled: true
forStages: [build]
stages:
- stage: build
jobs:
- job: main
displayName: Build package
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- pwsh: |
$data = Import-PowerShellDataFile -Path src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$($data.ModuleVersion)"
name: package
displayName: Get version from project properties
- task: onebranch.pipeline.version@1
displayName: Set OneBranch version
inputs:
system: Custom
customVersion: $(package.version)
- task: UseDotNet@2
displayName: Use .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
- task: PowerShell@2
displayName: Install PSResources
inputs:
pwsh: true
filePath: tools/installPSResources.ps1
- pwsh: Invoke-Build -Configuration $(BuildConfiguration)
displayName: Build
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party files
inputs:
command: sign
signing_profile: external_distribution
search_root: $(Build.SourcesDirectory)/module
files_to_sign: |
*.psd1;
Microsoft.PowerShell.*.dll;
- task: onebranch.pipeline.signing@1
displayName: Sign 3rd-party files
inputs:
command: sign
signing_profile: 135020002
search_root: $(Build.SourcesDirectory)/module
files_to_sign: |
NStack.dll;
Terminal.Gui.dll;
- task: ArchiveFiles@2
displayName: Zip module
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)/module
includeRootFolder: false
archiveType: zip
archiveFile: out/ConsoleGuiTools-v$(package.version).zip
- pwsh: Invoke-Build -Configuration $(BuildConfiguration) Package
displayName: Package module
- task: onebranch.pipeline.signing@1
displayName: Sign NuGet package
inputs:
command: sign
signing_profile: external_distribution
search_root: $(Build.SourcesDirectory)/out
files_to_sign: "*.nupkg"
- stage: release
dependsOn: build
variables:
version: $[ stageDependencies.build.main.outputs['package.version'] ]
drop: $(Pipeline.Workspace)/drop_build_main
jobs:
- job: github
displayName: Publish draft to GitHub
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: GitHubRelease@1
displayName: Create GitHub release
inputs:
gitHubConnection: GitHub
repositoryName: PowerShell/ConsoleGuiTools
assets: |
$(drop)/Microsoft.PowerShell.ConsoleGuiTools.$(version).nupkg
$(drop)/ConsoleGuiTools-v$(version).zip
tagSource: userSpecifiedTag
tag: v$(version)
isDraft: true
addChangeLog: false
releaseNotesSource: inline
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"
- job: validation
displayName: Manual validation
pool:
type: agentless
timeoutInMinutes: 1440
steps:
- task: ManualValidation@0
displayName: Wait 24 hours for validation
inputs:
notifyUsers: $(Build.RequestedForEmail)
instructions: Please validate the release and then publish it!
timeoutInMinutes: 1440
- job: publish
dependsOn: validation
displayName: Publish to PowerShell Gallery
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: NuGetCommand@2
displayName: Publish ConsoleGuiTools to PowerShell Gallery
inputs:
command: push
packagesToPush: $(drop)/Microsoft.PowerShell.ConsoleGuiTools.$(version).nupkg
publishFeedCredentials: PowerShellGallery
32 changes: 0 additions & 32 deletions .vscode/launch.json

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

22 changes: 0 additions & 22 deletions .vscode/tasks.json

This file was deleted.

31 changes: 0 additions & 31 deletions .vsts-ci/azure-pipelines-ci.yml

This file was deleted.

Loading