Skip to content

Commit a2b23fe

Browse files
authored
Publish NuGet package and PowerShell module in deploy box (#365)
1 parent 282c015 commit a2b23fe

File tree

7 files changed

+58
-30
lines changed

7 files changed

+58
-30
lines changed

.pipelines/Package-Official.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ extends:
5252
Network: KS3
5353
WindowsHostVersion:
5454
Version: 2022
55-
# Azure container/blob operations get blocked when using KS3
56-
Network: KS2
55+
Network: KS3
5756
globalSdl:
5857
disableLegacyManifest: true
5958
# disabled Armorty as we dont have any ARM templates to scan. It fails on some sample ARM templates.

.pipelines/Release-Official.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ parameters: # parameters are shown up in ADO UI in a build queue time
55
displayName: 'Enable debug output'
66
type: boolean
77
default: false
8+
- name: 'publish'
9+
displayName: 'Publish artifacts'
10+
type: boolean
11+
default: true
812

913
variables:
1014
- name: CDP_DEFINITION_BUILD_COUNT
@@ -36,15 +40,16 @@ resources:
3640
extends:
3741
template: v2/OneBranch.Official.CrossPlat.yml@templates
3842
parameters:
43+
release:
44+
category: NonAzure
3945
cloudvault:
4046
enabled: false
4147
featureFlags:
4248
LinuxHostVersion:
4349
Network: KS3
4450
WindowsHostVersion:
4551
Version: 2022
46-
# Azure container/blob operations get blocked when using KS3
47-
Network: KS2
52+
Network: KS3
4853
globalSdl:
4954
asyncSdl:
5055
enabled: true
@@ -108,22 +113,28 @@ extends:
108113
dependsOn: UpdateChangeLog
109114
jobs:
110115
- template: /.pipelines/templates/release-publish-github.yml@self
116+
parameters:
117+
publish: ${{ parameters.publish }}
111118

112119
- stage: PublishNuGet
113120
displayName: Publish NuGet
114121
dependsOn: PublishGitHubRelease
122+
variables:
123+
ob_release_environment: Production
115124
jobs:
116125
- template: /.pipelines/templates/release-publish-nuget.yml@self
117126
parameters:
118-
publish: true
127+
publish: ${{ parameters.publish }}
119128

120129
- stage: PublishModule
121130
displayName: Publish Module
122131
dependsOn: PublishGitHubRelease
132+
variables:
133+
ob_release_environment: Production
123134
jobs:
124135
- template: /.pipelines/templates/release-publish-module.yml@self
125136
parameters:
126-
publish: true
137+
publish: ${{ parameters.publish }}
127138

128139
- stage: PublishMsix
129140
dependsOn: PublishGitHubRelease

.pipelines/templates/module-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- group: DotNetPrivateBuildAccess
1818
- group: certificate_logical_to_actual
1919
- name: ob_sdl_sbom_enabled
20-
value: false
20+
value: true
2121
- name: ob_outputDirectory
2222
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
2323
- name: repoRoot

.pipelines/templates/nupkg-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- group: mscodehub-feed-read-akv
2727
- group: DotNetPrivateBuildAccess
2828
- name: ob_sdl_sbom_enabled
29-
value: false
29+
value: true
3030
- name: ob_sdl_codeql_compiled_enabled
3131
value: false
3232

.pipelines/templates/release-publish-github.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
- name: publish
3+
default: false
4+
type: boolean
5+
16
jobs:
27
- job: GithubReleaseDraft
38
displayName: Create GitHub Release Draft
@@ -84,6 +89,7 @@ jobs:
8489
$description = '<!-- TODO: Generate release notes on GitHub! -->'
8590
Publish-ReleaseDraft -Tag $releaseTag -Name "$releaseTag Release of AIShell" -Description $description -User PowerShell -Repository AIShell -PackageFolder $(PackagesRoot) -Token $(GitHubReleasePat)
8691
displayName: Publish Release Draft
92+
condition: and(ne('${{ parameters.publish }}', 'false'), succeeded())
8793
8894
- template: /.pipelines/templates/wait-for-approval.yml@self
8995
parameters:

.pipelines/templates/release-publish-module.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,36 @@ parameters:
66
jobs:
77
- job: ModulePublish
88
displayName: Publish to PSGallery
9+
pool:
10+
type: release
11+
os: windows
12+
templateContext:
13+
inputs:
14+
- input: pipelineArtifact
15+
pipeline: AIShellPackagePipeline
16+
artifactName: drop_module_package
917
variables:
10-
- name: ob_outputDirectory
11-
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
1218
# Disable SBOM, signing, and codeQL for this job
1319
- name: ob_sdl_sbom_enabled
1420
value: false
1521
- name: ob_signing_setup_enabled
1622
value: false
1723
- name: ob_sdl_codeql_compiled_enabled
1824
value: false
19-
pool:
20-
type: windows
2125

2226
steps:
23-
- download: AIShellPackagePipeline
24-
artifact: drop_module_package
25-
displayName: Download module package
26-
27-
- pwsh: |
28-
Get-ChildItem '$(Pipeline.Workspace)/AIShellPackagePipeline/drop_module_package/*.nupkg' -recurse
27+
- task: PowerShell@2
28+
inputs:
29+
targetType: 'inline'
30+
script: |
31+
Get-ChildItem '$(Pipeline.Workspace)/*.nupkg' -recurse
2932
displayName: List nupkg package
3033

3134
- task: NuGetCommand@2
3235
displayName: Push AIShell module to PSGallery feed
3336
condition: and(ne('${{ parameters.publish }}', 'false'), succeeded())
3437
inputs:
3538
command: push
36-
packagesToPush: '$(Pipeline.Workspace)/AIShellPackagePipeline/drop_module_package/*.nupkg'
39+
packagesToPush: '$(Pipeline.Workspace)/*.nupkg'
3740
nuGetFeedType: external
3841
publishFeedCredentials: PowerShellGallery-dongbow

.pipelines/templates/release-publish-nuget.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,35 @@ jobs:
88
displayName: Publish to NuGet
99
condition: succeeded()
1010
pool:
11-
type: windows
11+
type: release
12+
os: windows
13+
templateContext:
14+
inputs:
15+
- input: pipelineArtifact
16+
pipeline: AIShellPackagePipeline
17+
artifactName: drop_nupkg_package
1218
variables:
13-
- group: 'mscodehub-code-read-akv'
14-
- name: ob_outputDirectory
15-
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
19+
# Disable SBOM, signing, and codeQL for this job
20+
- name: ob_sdl_sbom_enabled
21+
value: false
22+
- name: ob_signing_setup_enabled
23+
value: false
24+
- name: ob_sdl_codeql_compiled_enabled
25+
value: false
1626

1727
steps:
18-
- download: AIShellPackagePipeline
19-
artifact: drop_nupkg_package
20-
displayName: Download nuget packages
21-
22-
- pwsh: |
23-
Get-ChildItem '$(Pipeline.Workspace)/AIShellPackagePipeline/drop_nupkg_package/*.nupkg' -recurse
28+
- task: PowerShell@2
29+
inputs:
30+
targetType: 'inline'
31+
script: |
32+
Get-ChildItem '$(Pipeline.Workspace)/*.nupkg' -recurse
2433
displayName: List nupkg package
2534

2635
- task: NuGetCommand@2
2736
displayName: 'NuGet push'
2837
condition: and(ne('${{ parameters.publish }}', 'false'), succeeded())
2938
inputs:
3039
command: push
31-
packagesToPush: '$(Pipeline.Workspace)/AIShellPackagePipeline/drop_nupkg_package/*.nupkg'
40+
packagesToPush: '$(Pipeline.Workspace)/*.nupkg'
3241
nuGetFeedType: external
3342
publishFeedCredentials: PowerShellNuGetOrgPush

0 commit comments

Comments
 (0)