Skip to content

Commit 60bc56f

Browse files
authored
refactor: create .vsix instead of relying on CI (#432)
1 parent a728080 commit 60bc56f

File tree

5 files changed

+65
-25
lines changed

5 files changed

+65
-25
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,11 @@ jobs:
4141
run: pnpm integrity
4242

4343
- name: Build extension
44+
id: build
4445
run: pnpm build
4546

46-
- name: Package extension
47-
uses: haaleo/publish-vscode-extension@v1
48-
id: package
49-
with:
50-
pat: _
51-
dependencies: false
52-
dryRun: true
53-
5447
- name: Upload VSIX artifact
5548
uses: actions/upload-artifact@v4
5649
with:
57-
name: ${{ steps.package.outputs.vsixPath }}
58-
path: ${{ steps.package.outputs.vsixPath }}
50+
name: ${{ steps.build.outputs.vsixPath }}
51+
path: ${{ steps.build.outputs.vsixPath }}

.github/workflows/publish.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,14 @@ jobs:
3838
run: pnpm integrity
3939

4040
- name: Build extension
41+
id: build
4142
run: pnpm build
4243

43-
- name: Package extension
44-
uses: haaleo/publish-vscode-extension@v1
45-
id: package
46-
with:
47-
pat: _
48-
dependencies: false
49-
dryRun: true
50-
5144
- name: Upload binary to GitHub release
5245
uses: svenstaro/upload-release-action@v2
5346
with:
5447
repo_token: ${{ secrets.GITHUB_TOKEN }}
55-
file: ${{ steps.package.outputs.vsixPath }}
48+
file: ${{ steps.build.outputs.vsixPath }}
5649
tag: ${{ github.ref }}
5750
body: Please refer to [CHANGELOG.md](https://github.com/catppuccin/vscode-icons/blob/main/CHANGELOG.md) for details.
5851
overwrite: true
@@ -61,7 +54,7 @@ jobs:
6154
uses: haaleo/publish-vscode-extension@v1
6255
with:
6356
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
64-
extensionFile: ${{ steps.package.outputs.vsixPath }}
57+
extensionFile: ${{ steps.build.outputs.vsixPath }}
6558
registryUrl: https://marketplace.visualstudio.com
6659
dependencies: false
6760

@@ -71,4 +64,4 @@ jobs:
7164
timeout-minutes: 10
7265
with:
7366
pat: ${{ secrets.OPEN_VSX_TOKEN }}
74-
extensionFile: ${{ steps.package.outputs.vsixPath }}
67+
extensionFile: ${{ steps.build.outputs.vsixPath }}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,11 @@
127127
"integrity": "tsx scripts/integrity.ts",
128128
"lint": "eslint .",
129129
"lint:fix": "eslint . --fix",
130-
"pack": "vsce package --no-dependencies",
131130
"release": "changelogen --release",
132-
"typecheck": "tsc",
133-
"vscode:prepublish": "pnpm build"
131+
"typecheck": "tsc"
134132
},
135133
"devDependencies": {
134+
"@actions/core": "^1.11.1",
136135
"@antfu/eslint-config": "^3.7.1",
137136
"@catppuccin/palette": "^1.4.0",
138137
"@iconify/tools": "^4.0.6",

pnpm-lock.yaml

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
import { existsSync } from 'node:fs'
66
import { cp, readdir, rm, writeFile } from 'node:fs/promises'
77
import { basename, join } from 'node:path'
8-
import { exit } from 'node:process'
8+
import { env, exit } from 'node:process'
9+
import { setOutput } from '@actions/core'
910
import { flavorEntries } from '@catppuccin/palette'
11+
import { createVSIX } from '@vscode/vsce'
1012
import { consola } from 'consola'
13+
import packageJson from 'package.json' assert { type: 'json' }
1114
import { build } from 'tsup'
1215
import { compileTheme } from '~/utils/themes'
1316

@@ -88,6 +91,13 @@ try {
8891
shims: true,
8992
})
9093

94+
// package .vsix
95+
const packagePath = `${packageJson.name}-${packageJson.version}.vsix`
96+
await createVSIX({ dependencies: false, packagePath })
97+
if (env.GITHUB_ACTIONS) {
98+
setOutput('vsixPath', packagePath)
99+
}
100+
91101
consola.success('Built VSC extension.')
92102
}
93103
catch (error) {

0 commit comments

Comments
 (0)