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-marketplace-publish.yml

108lines · modecode

1name: Extension Marketplace Publish
2
3on:
4 workflow_call:
5 inputs:
6 collections-matrix:
7 description: "JSON matrix of collections to publish"
8 required: true
9 type: string
10 pre-release:
11 description: "Publish as pre-release extension"
12 required: false
13 type: boolean
14 default: false
15
16permissions:
17 contents: read
18
19jobs:
20 publish:
21 name: Publish ${{ matrix.id }}
22 runs-on: ubuntu-latest
23 environment: marketplace
24 strategy:
25 fail-fast: false
26 matrix: ${{ fromJson(inputs.collections-matrix) }}
27 permissions:
28 contents: read
29 id-token: write
30 steps:
31 - name: Checkout code
32 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
33 with:
34 persist-credentials: false
35
36 - name: Azure Login (OIDC)
37 uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
38 with:
39 client-id: ${{ secrets.AZURE_CLIENT_ID }}
40 tenant-id: ${{ secrets.AZURE_TENANT_ID }}
41 subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
42
43 - name: Setup Node.js
44 uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
45 with:
46 node-version: "20"
47
48 - name: Install dependencies
49 run: npm ci
50
51 - name: Download VSIX artifact
52 uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
53 with:
54 name: extension-vsix-${{ matrix.id }}
55 path: ./dist
56
57 - name: Publish to VS Code Marketplace
58 id: publish
59 env:
60 PRE_RELEASE: ${{ inputs.pre-release }}
61 COLLECTION_ID: ${{ matrix.id }}
62 run: |
63 VSIX_FILE=$(find dist -name '*.vsix' | head -1)
64 if [ -z "$VSIX_FILE" ]; then
65 echo "::error::No VSIX file found for collection $COLLECTION_ID"
66 exit 1
67 fi
68 VSIX_VERSION=$(basename "$VSIX_FILE" .vsix | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$')
69 echo "version=$VSIX_VERSION" >> "$GITHUB_OUTPUT"
70
71 CHANNEL_LABEL="Stable"
72 PRE_RELEASE_FLAG=""
73 if [ "$PRE_RELEASE" == "true" ]; then
74 CHANNEL_LABEL="Pre-Release"
75 PRE_RELEASE_FLAG="--pre-release"
76 fi
77
78 echo "📦 Publishing $COLLECTION_ID: $VSIX_FILE (v$VSIX_VERSION) [$CHANNEL_LABEL]"
79 npx vsce publish --packagePath "$VSIX_FILE" $PRE_RELEASE_FLAG --azure-credential
80
81 - name: Summary
82 env:
83 PRE_RELEASE: ${{ inputs.pre-release }}
84 COLLECTION_ID: ${{ matrix.id }}
85 COLLECTION_NAME: ${{ matrix.name }}
86 PUBLISH_VERSION: ${{ steps.publish.outputs.version }}
87 run: |
88 CHANNEL_LABEL="Stable"
89 EMOJI="🎉"
90 EXTRA=""
91 if [ "$PRE_RELEASE" == "true" ]; then
92 CHANNEL_LABEL="Pre-Release"
93 EMOJI="🚀"
94 EXTRA=$'\nUsers can install via **Switch to Pre-Release Version** in VS Code.\n'
95 fi
96
97 {
98 echo "## ${EMOJI} Extension Published: $COLLECTION_NAME"
99 echo ""
100 echo "**Collection:** $COLLECTION_ID"
101 echo "**Version:** $PUBLISH_VERSION"
102 echo "**Channel:** $CHANNEL_LABEL"
103 echo ""
104 if [ -n "$EXTRA" ]; then
105 echo "$EXTRA"
106 fi
107 echo "View on [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ise-hve-essentials.${COLLECTION_NAME})"
108 } >> "$GITHUB_STEP_SUMMARY"
109