microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ci/884-codeql-python-analysis

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/extension-package.yml

164lines · modecode

1name: Package Extension
2
3on:
4 workflow_call:
5 inputs:
6 version:
7 description: "Full version to use (e.g., 1.0.0 or empty to use package.json)"
8 required: false
9 type: string
10 default: ""
11 dev-patch-number:
12 description: "Dev patch number to append (creates version like 1.0.0-dev.123)"
13 required: false
14 type: string
15 default: ""
16 use-changelog:
17 description: "Whether to download and use changelog artifact"
18 required: false
19 type: boolean
20 default: false
21 channel:
22 description: "Release channel (Stable or PreRelease) controlling agent maturity filtering"
23 required: false
24 type: string
25 default: "Stable"
26 outputs:
27 version:
28 description: "Version that was packaged"
29 value: ${{ jobs.discover-collections.outputs.version }}
30 collections-matrix:
31 description: "JSON matrix of collections that were actually packaged (filtered by channel and maturity)"
32 value: ${{ jobs.discover-collections.outputs.matrix }}
33
34permissions:
35 contents: read
36
37jobs:
38 discover-collections:
39 name: Discover Collection Manifests
40 runs-on: ubuntu-latest
41 permissions:
42 contents: read
43 outputs:
44 matrix: ${{ steps.discover.outputs.matrix }}
45 version: ${{ steps.read-version.outputs.version }}
46 steps:
47 - name: Checkout code
48 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
49 with:
50 persist-credentials: false
51
52 - name: Setup PowerShell modules
53 shell: pwsh
54 run: |
55 Install-Module -Name PowerShell-Yaml -Force -Scope CurrentUser
56
57 - name: Resolve effective version
58 id: read-version
59 shell: bash
60 run: |
61 version="${{ inputs.version }}"
62 dev_patch="${{ inputs.dev-patch-number }}"
63 if [ -z "$version" ]; then
64 version=$(jq -r .version extension/templates/package.template.json)
65 fi
66 if [ -n "$dev_patch" ]; then
67 version="${version}-dev.${dev_patch}"
68 fi
69 echo "version=$version" >> "$GITHUB_OUTPUT"
70
71 - name: Discover collection manifests
72 id: discover
73 shell: pwsh
74 run: |
75 & ./scripts/extension/Find-CollectionManifests.ps1 -Channel '${{ inputs.channel }}'
76
77 package:
78 name: Package ${{ matrix.id }}
79 needs: discover-collections
80 runs-on: ubuntu-latest
81 permissions:
82 contents: read
83 strategy:
84 fail-fast: false
85 matrix: ${{ fromJson(needs.discover-collections.outputs.matrix) }}
86 steps:
87 - name: Checkout code
88 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
89 with:
90 persist-credentials: false
91
92 - name: Setup Node.js
93 uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
94 with:
95 node-version: "20"
96
97 - name: Install dependencies
98 run: npm ci
99
100 - name: Setup PowerShell
101 shell: pwsh
102 run: |
103 Write-Host "PowerShell version: $($PSVersionTable.PSVersion)"
104 Install-Module -Name PowerShell-Yaml -Force -Scope CurrentUser
105
106 - name: Download changelog artifact
107 if: inputs.use-changelog
108 uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
109 with:
110 name: changelog
111 path: ./
112 continue-on-error: true
113
114 - name: Prepare extension resources
115 id: prepare
116 shell: pwsh
117 run: |
118 $channel = "${{ inputs.channel }}".Trim()
119 if (-not $channel) { $channel = 'Stable' }
120 $collection = "${{ matrix.manifest }}"
121
122 Write-Host "🔧 Preparing extension for $channel channel (collection: ${{ matrix.id }})..."
123 ./scripts/extension/Prepare-Extension.ps1 -Channel $channel -Collection $collection
124
125 - name: Package extension
126 id: package
127 shell: pwsh
128 run: |
129 $version = "${{ inputs.version }}".Trim()
130 $devPatch = "${{ inputs.dev-patch-number }}".Trim()
131 $channel = "${{ inputs.channel }}".Trim()
132 if (-not $channel) { $channel = 'Stable' }
133 $collection = "${{ matrix.manifest }}"
134
135 Write-Host "📦 Packaging extension for $channel channel (collection: ${{ matrix.id }})..."
136
137 $arguments = @{
138 Collection = $collection
139 }
140
141 if ($channel -ieq 'PreRelease') {
142 $arguments['PreRelease'] = $true
143 }
144
145 if ($version) {
146 $arguments['Version'] = $version
147 }
148
149 if ($devPatch) {
150 $arguments['DevPatchNumber'] = $devPatch
151 }
152
153 if (Test-Path "./CHANGELOG.md") {
154 $arguments['ChangelogPath'] = "./CHANGELOG.md"
155 }
156
157 ./scripts/extension/Package-Extension.ps1 @arguments
158
159 - name: Upload VSIX artifact
160 uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4.4.3
161 with:
162 name: extension-vsix-${{ matrix.id }}
163 path: extension/*.vsix
164 retention-days: 30
165