microsoft/hve-core

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/address-powershell-test-comments

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/extension-publish.yml

137lines · modecode

1name: Publish Extension
2
3on:
4 # Release trigger disabled - extension publishing is manual-only
5 # Uncomment to enable auto-publish on GitHub releases:
6 # release:
7 # types: [published]
8 workflow_dispatch:
9 inputs:
10 version:
11 description: 'Version to publish (leave empty to use package.json version)'
12 required: false
13 type: string
14 default: ''
15 dry-run:
16 description: 'Dry run (package only, do not publish)'
17 required: false
18 type: boolean
19 default: false
20
21permissions:
22 contents: read
23
24jobs:
25 prepare-changelog:
26 name: Prepare Changelog
27 runs-on: ubuntu-latest
28 outputs:
29 changelog-path: ${{ steps.create-changelog.outputs.path }}
30 steps:
31 - name: Checkout code
32 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
33 with:
34 persist-credentials: false
35
36 - name: Create changelog file
37 id: create-changelog
38 run: |
39 if [ "${{ github.event_name }}" == "release" ]; then
40 cat > CHANGELOG.md << 'EOF'
41 ${{ github.event.release.body }}
42 EOF
43 echo "path=CHANGELOG.md" >> "$GITHUB_OUTPUT"
44 elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
45 echo "path=" >> "$GITHUB_OUTPUT"
46 else
47 echo "path=" >> "$GITHUB_OUTPUT"
48 fi
49
50 - name: Upload changelog
51 if: steps.create-changelog.outputs.path != ''
52 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v4.4.3
53 with:
54 name: changelog
55 path: CHANGELOG.md
56 retention-days: 1
57
58 normalize-version:
59 name: Normalize Version
60 runs-on: ubuntu-latest
61 outputs:
62 version: ${{ steps.normalize.outputs.version }}
63 steps:
64 - name: Normalize version string
65 id: normalize
66 run: |
67 if [ "${{ github.event_name }}" == "release" ]; then
68 VERSION="${{ github.event.release.tag_name }}"
69 else
70 VERSION="${{ inputs.version }}"
71 fi
72 # Strip leading 'v' if present
73 VERSION="${VERSION#v}"
74 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
75
76 package:
77 name: Package Extension
78 needs: [prepare-changelog, normalize-version]
79 uses: ./.github/workflows/extension-package.yml
80 with:
81 version: ${{ needs.normalize-version.outputs.version }}
82 use-changelog: ${{ needs.prepare-changelog.outputs.changelog-path != '' }}
83 permissions:
84 contents: read
85
86 publish:
87 name: Publish to Marketplace
88 needs: [prepare-changelog, package]
89 if: ${{ !inputs.dry-run }}
90 runs-on: ubuntu-latest
91 environment: marketplace
92 permissions:
93 contents: read
94 id-token: write
95 steps:
96 - name: Checkout code
97 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
98 with:
99 persist-credentials: false
100
101 - name: Azure Login (OIDC)
102 uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
103 with:
104 client-id: ${{ secrets.AZURE_CLIENT_ID }}
105 tenant-id: ${{ secrets.AZURE_TENANT_ID }}
106 subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
107
108 - name: Setup Node.js
109 uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.1.0
110 with:
111 node-version: '20'
112
113 - name: Install VSCE
114 run: npm install -g @vscode/vsce@3.7.1
115
116 - name: Download VSIX artifact
117 uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
118 with:
119 name: extension-vsix
120 path: ./extension
121
122 - name: Publish to VS Code Marketplace
123 run: |
124 VSIX_FILE=$(find extension -name 'hve-core-*.vsix' -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)
125 echo "📦 Publishing: $VSIX_FILE"
126 vsce publish --packagePath "$VSIX_FILE" --azure-credential
127
128 - name: Summary
129 run: |
130 {
131 echo "## 🎉 Extension Published Successfully"
132 echo ""
133 echo "**Version:** ${{ needs.package.outputs.version }}"
134 echo "**VSIX File:** ${{ needs.package.outputs.vsix-file }}"
135 echo ""
136 echo "View on [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ise-hve-essentials.hve-core)"
137 } >> "$GITHUB_STEP_SUMMARY"
138