Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 5a04962

Browse files
authored
Publish VSX to open-vsx.org (#241)
1 parent 751b6d6 commit 5a04962

File tree

4 files changed

+27
-13
lines changed

4 files changed

+27
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: CI/CD
2-
"on":
2+
'on':
33
pull_request:
44
branches:
55
- main
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup Node
3737
uses: actions/setup-node@v2
3838
with:
39-
node-version: "16"
39+
node-version: '16'
4040
- name: Setup PNPM
4141
uses: pnpm/[email protected]
4242
with:
@@ -63,7 +63,7 @@ jobs:
6363
- name: Setup Node
6464
uses: actions/setup-node@v2
6565
with:
66-
node-version: "16"
66+
node-version: '16'
6767
- name: Setup PNPM
6868
uses: pnpm/[email protected]
6969
with:
@@ -102,7 +102,7 @@ jobs:
102102
- name: Setup Node
103103
uses: actions/setup-node@v2
104104
with:
105-
node-version: "16"
105+
node-version: '16'
106106
- name: Setup PNPM
107107
uses: pnpm/[email protected]
108108
with:
@@ -119,11 +119,11 @@ jobs:
119119
run: >
120120
pnpm recursive --filter ./extension run build
121121
122-
pnpm recursive --filter ./extension run pre-release
122+
pnpm recursive --filter ./extension run release
123123
env:
124124
RELEASE_CHANNEL: pre-release
125125
VSCODE_MARKETPLACE_TOKEN: ${{ secrets.VSCE_TOKEN }}
126-
# OVSX_REGISTRY_TOKEN: ${{ secrets.OVSX_REGISTRY_TOKEN }}
126+
OVSX_REGISTRY_TOKEN: ${{ secrets.OVSX_REGISTRY_TOKEN }}
127127
- name: Publish Pre-release Packages
128128
run: >
129129
pnpm recursive exec -- pnpm version prerelease --preid=next-$(date
@@ -171,7 +171,7 @@ jobs:
171171
- name: Setup Node
172172
uses: actions/setup-node@v2
173173
with:
174-
node-version: "16"
174+
node-version: '16'
175175
- name: Setup PNPM
176176
uses: pnpm/[email protected]
177177
with:
@@ -192,7 +192,7 @@ jobs:
192192
193193
env:
194194
VSCODE_MARKETPLACE_TOKEN: ${{ secrets.VSCE_TOKEN }}
195-
# OVSX_REGISTRY_TOKEN: ${{ secrets.OVSX_REGISTRY_TOKEN }}
195+
OVSX_REGISTRY_TOKEN: ${{ secrets.OVSX_REGISTRY_TOKEN }}
196196
continue-on-error: true
197197
- name: Publish Packages
198198
run: |

extension/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"icon": "assets/logo.png",
99
"preview": true,
1010
"engines": {
11-
"vscode": "^1.66.0"
11+
"vscode": "^1.63.0"
1212
},
1313
"repository": {
1414
"type": "git",
@@ -343,14 +343,13 @@
343343
],
344344
"scripts": {
345345
"build": "node ../scripts/build-extension.mjs",
346-
"release": "vsce publish -p ${VSCODE_MARKETPLACE_TOKEN} --packagePath grammarly.vsix",
347-
"pre-release": "vsce publish --pre-release -p ${VSCODE_MARKETPLACE_TOKEN} --packagePath grammarly.vsix"
346+
"release": "node ../scripts/publish-extension.mjs"
348347
},
349348
"dependencies": {
350349
"grammarly-languageclient": "workspace:*",
351350
"grammarly-languageserver": "workspace:*"
352351
},
353352
"devDependencies": {
354-
"@types/vscode": "^1.66.0"
353+
"@types/vscode": "^1.63.0"
355354
}
356355
}

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/publish-extension.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @ts-check
2+
import { execSync } from 'node:child_process'
3+
import * as Path from 'node:path'
4+
import { fileURLToPath } from 'node:url'
5+
6+
const rootDir = Path.resolve(Path.dirname(fileURLToPath(import.meta.url)), '..')
7+
const extensionDir = Path.resolve(rootDir, 'extension')
8+
const bin = Path.resolve(rootDir, 'node_modules/.bin/vsce')
9+
const execArgs = { stdio: [0, 1, 2], cwd: extensionDir }
10+
const RELEASE_CHANNEL = /** @type {'release'|'pre-release'} */ (process.env['RELEASE_CHANNEL'] ?? 'release')
11+
const VSCODE_MARKETPLACE_TOKEN = process.env.VSCODE_MARKETPLACE_TOKEN
12+
const OVSX_REGISTRY_TOKEN = process.env.OVSX_REGISTRY_TOKEN
13+
const args = RELEASE_CHANNEL === 'pre-release' ? '--pre-release' : ''
14+
execSync(`${bin} publish -p "${VSCODE_MARKETPLACE_TOKEN}" ${args} --packagePath grammarly.vsix`, execArgs)
15+
execSync(`pnpx -y ovsx publish -p "${OVSX_REGISTRY_TOKEN}" --packagePath grammarly.vsix`, execArgs) // Does not support pre-release arg yet.

0 commit comments

Comments
 (0)