-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (89 loc) · 3.89 KB
/
Copy pathrelease.yml
File metadata and controls
103 lines (89 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release
# Releases lane:
# - Push a tag like `v1.2.3` (or run manually) to build the VSIX, generate
# human-friendly release notes from CHANGELOG.md, and publish a GitHub
# Release with the VSIX attached as a downloadable asset.
# - Marketplace publishing (VS Code Marketplace + Open VSX / Cursor) runs
# automatically only once the matching secrets are added — see below.
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g. 1.2.3). Defaults to package.slim.json."
required: false
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
release:
name: Build, release & package
runs-on: ubuntu-latest
env:
# Empty when the secret is not set — used to gate the publish steps.
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Compile & test
run: npm run test:critical
- name: Resolve version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
elif [ "${GITHUB_REF_TYPE}" = "tag" ]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="$(node -p "require('./package.slim.json').version")"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "vsix=build/export2ai-${VERSION}.vsix" >> "$GITHUB_OUTPUT"
echo "vsix_name=export2ai-${VERSION}.vsix" >> "$GITHUB_OUTPUT"
echo "Releasing version ${VERSION}"
- name: Generate release notes
run: npm run release:notes -- --version "${{ steps.version.outputs.version }}" --output RELEASE_NOTES.md
- name: Upload VSIX as workflow artifact
uses: actions/upload-artifact@v7
with:
name: ${{ steps.version.outputs.vsix_name }}
path: ${{ steps.version.outputs.vsix }}
if-no-files-found: error
- name: Create / update GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.version.outputs.version }}
name: Export2AI v${{ steps.version.outputs.version }}
body_path: RELEASE_NOTES.md
files: ${{ steps.version.outputs.vsix }}
draft: false
prerelease: false
# --- Marketplace publishing (optional) -------------------------------
# Add repo secrets to enable. These steps are skipped while the secrets
# are empty, so the workflow stays green until you are ready to publish.
# VSCE_PAT → https://marketplace.visualstudio.com (Azure DevOps PAT)
# OVSX_PAT → https://open-vsx.org (used by Cursor / VSCodium)
# Publisher identity is `avnsx.export2ai` from package.slim.json.
- name: Publish to VS Code Marketplace
if: ${{ env.VSCE_PAT != '' }}
run: npx --yes @vscode/vsce publish --packagePath "${{ steps.version.outputs.vsix }}" --pat "$VSCE_PAT"
- name: Publish to Open VSX (Cursor / VSCodium)
if: ${{ env.OVSX_PAT != '' }}
run: |
EXTENSION_ID="$(node -p "const p = require('./package.json'); p.publisher + '.' + p.name")"
if npx --yes ovsx get "$EXTENSION_ID" --versionRange "${{ steps.version.outputs.version }}" --metadata >/tmp/open-vsx-existing.json 2>/dev/null; then
echo "Open VSX already has ${EXTENSION_ID} ${{ steps.version.outputs.version }}; skipping duplicate publish."
else
npx --yes ovsx publish "${{ steps.version.outputs.vsix }}" --skip-duplicate --pat "$OVSX_PAT"
fi