microsoft/hve-core

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
hve-core-v2.3.4

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/extension-publish-prerelease.yml

126lines · modecode

1name: Publish Pre-Release Extension
2
3on:
4 workflow_dispatch:
5 inputs:
6 version:
7 description: 'ODD minor version (e.g., 1.1.0, 1.3.0). Must use ODD minor number.'
8 required: true
9 type: string
10 dry-run:
11 description: 'Dry run (package only, do not publish)'
12 required: false
13 type: boolean
14 default: false
15
16permissions:
17 contents: read
18
19jobs:
20 validate-version:
21 name: Validate Pre-Release Version
22 runs-on: ubuntu-latest
23 outputs:
24 version: ${{ steps.validate.outputs.version }}
25 steps:
26 - name: Validate ODD minor version
27 id: validate
28 run: |
29 VERSION="${{ inputs.version }}"
30 # Strip leading 'v' if present
31 VERSION="${VERSION#v}"
32
33 # Validate format
34 if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
35 echo "::error::Invalid version format: $VERSION. Expected semantic version (e.g., 1.1.0)"
36 exit 1
37 fi
38
39 # Extract minor version
40 MINOR=$(echo "$VERSION" | cut -d. -f2)
41
42 # Check if ODD (pre-release channel uses ODD minor versions)
43 if (( MINOR % 2 == 0 )); then
44 echo "::error::Pre-release requires ODD minor version. Got: $VERSION (minor=$MINOR is EVEN)"
45 echo "::error::Use version like 1.1.0, 1.3.0, 2.1.0 for pre-release channel"
46 exit 1
47 fi
48
49 echo "✅ Valid pre-release version: $VERSION (minor=$MINOR is ODD)"
50 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
51
52 package:
53 name: Package Pre-Release Extensions
54 needs: validate-version
55 uses: ./.github/workflows/extension-package.yml
56 with:
57 version: ${{ needs.validate-version.outputs.version }}
58 channel: PreRelease
59 permissions:
60 contents: read
61
62 publish:
63 name: Publish ${{ matrix.id }}
64 needs: [package]
65 if: ${{ !inputs.dry-run }}
66 runs-on: ubuntu-latest
67 environment: marketplace
68 strategy:
69 fail-fast: false
70 matrix: ${{ fromJson(needs.package.outputs.collections-matrix) }}
71 permissions:
72 contents: read
73 id-token: write
74 steps:
75 - name: Checkout code
76 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
77 with:
78 persist-credentials: false
79
80 - name: Azure Login (OIDC)
81 uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
82 with:
83 client-id: ${{ secrets.AZURE_CLIENT_ID }}
84 tenant-id: ${{ secrets.AZURE_TENANT_ID }}
85 subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
86
87 - name: Setup Node.js
88 uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.1.0
89 with:
90 node-version: '20'
91
92 - name: Install VSCE
93 run: npm install -g @vscode/vsce@3.7.1
94
95 - name: Download VSIX artifact
96 uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
97 with:
98 name: extension-vsix-${{ matrix.id }}
99 path: ./dist
100
101 - name: Publish pre-release to VS Code Marketplace
102 id: publish
103 run: |
104 VSIX_FILE=$(find dist -name '*.vsix' -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)
105 if [ -z "$VSIX_FILE" ]; then
106 echo "::error::No VSIX file found for collection ${{ matrix.id }}"
107 exit 1
108 fi
109 VSIX_VERSION=$(basename "$VSIX_FILE" .vsix | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$')
110 echo "version=$VSIX_VERSION" >> "$GITHUB_OUTPUT"
111 echo "📦 Publishing pre-release ${{ matrix.id }}: $VSIX_FILE (v$VSIX_VERSION)"
112 vsce publish --packagePath "$VSIX_FILE" --pre-release --azure-credential
113
114 - name: Summary
115 run: |
116 {
117 echo "## 🚀 Pre-Release Extension Published: ${{ matrix.name }}"
118 echo ""
119 echo "**Collection:** ${{ matrix.id }}"
120 echo "**Version:** ${{ steps.publish.outputs.version }}"
121 echo "**Channel:** Pre-Release (ODD minor)"
122 echo ""
123 echo "Users can install via **Switch to Pre-Release Version** in VS Code."
124 echo ""
125 echo "View on [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ise-hve-essentials.${{ matrix.name }})"
126 } >> "$GITHUB_STEP_SUMMARY"
127