refactor: create .vsix instead of relying on CI (#432)

This commit is contained in:
Hammy 2025-03-16 14:25:37 +00:00 committed by GitHub
parent a728080306
commit 60bc56fffb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 65 additions and 25 deletions

View File

@ -41,18 +41,11 @@ jobs:
run: pnpm integrity
- name: Build extension
id: build
run: pnpm build
- name: Package extension
uses: haaleo/publish-vscode-extension@v1
id: package
with:
pat: _
dependencies: false
dryRun: true
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.vsixPath }}
path: ${{ steps.package.outputs.vsixPath }}
name: ${{ steps.build.outputs.vsixPath }}
path: ${{ steps.build.outputs.vsixPath }}

View File

@ -38,21 +38,14 @@ jobs:
run: pnpm integrity
- name: Build extension
id: build
run: pnpm build
- name: Package extension
uses: haaleo/publish-vscode-extension@v1
id: package
with:
pat: _
dependencies: false
dryRun: true
- name: Upload binary to GitHub release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.vsixPath }}
file: ${{ steps.build.outputs.vsixPath }}
tag: ${{ github.ref }}
body: Please refer to [CHANGELOG.md](https://github.com/catppuccin/vscode-icons/blob/main/CHANGELOG.md) for details.
overwrite: true
@ -61,7 +54,7 @@ jobs:
uses: haaleo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
extensionFile: ${{ steps.package.outputs.vsixPath }}
extensionFile: ${{ steps.build.outputs.vsixPath }}
registryUrl: https://marketplace.visualstudio.com
dependencies: false
@ -71,4 +64,4 @@ jobs:
timeout-minutes: 10
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ${{ steps.package.outputs.vsixPath }}
extensionFile: ${{ steps.build.outputs.vsixPath }}

View File

@ -127,12 +127,11 @@
"integrity": "tsx scripts/integrity.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"pack": "vsce package --no-dependencies",
"release": "changelogen --release",
"typecheck": "tsc",
"vscode:prepublish": "pnpm build"
"typecheck": "tsc"
},
"devDependencies": {
"@actions/core": "^1.11.1",
"@antfu/eslint-config": "^3.7.1",
"@catppuccin/palette": "^1.4.0",
"@iconify/tools": "^4.0.6",

45
pnpm-lock.yaml generated
View File

@ -8,6 +8,9 @@ importers:
.:
devDependencies:
'@actions/core':
specifier: ^1.11.1
version: 1.11.1
'@antfu/eslint-config':
specifier: ^3.7.1
version: 3.8.0(@typescript-eslint/utils@8.13.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(@vue/compiler-sfc@3.4.15)(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
@ -62,6 +65,18 @@ importers:
packages:
'@actions/core@1.11.1':
resolution: {integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==}
'@actions/exec@1.1.1':
resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==}
'@actions/http-client@2.2.3':
resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==}
'@actions/io@1.1.3':
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
'@antfu/eslint-config@3.8.0':
resolution: {integrity: sha512-O5QSufPHpKTm0wk1OQ5c2mOZVzCqYV3hIDrt5zt+cOWqiG8YXLPkSOD4fFwjomATtOuUbcLUwkcgY5dErM7aIw==}
hasBin: true
@ -421,6 +436,10 @@ packages:
resolution: {integrity: sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@fastify/busboy@2.1.1':
resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
engines: {node: '>=14'}
'@humanfs/core@0.19.1':
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
@ -2981,6 +3000,10 @@ packages:
undici-types@6.20.0:
resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
undici@5.28.5:
resolution: {integrity: sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==}
engines: {node: '>=14.0'}
undici@6.21.1:
resolution: {integrity: sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==}
engines: {node: '>=18.17'}
@ -3134,6 +3157,22 @@ packages:
snapshots:
'@actions/core@1.11.1':
dependencies:
'@actions/exec': 1.1.1
'@actions/http-client': 2.2.3
'@actions/exec@1.1.1':
dependencies:
'@actions/io': 1.1.3
'@actions/http-client@2.2.3':
dependencies:
tunnel: 0.0.6
undici: 5.28.5
'@actions/io@1.1.3': {}
'@antfu/eslint-config@3.8.0(@typescript-eslint/utils@8.13.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(@vue/compiler-sfc@3.4.15)(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)':
dependencies:
'@antfu/install-pkg': 0.4.1
@ -3464,6 +3503,8 @@ snapshots:
'@eslint/core': 0.12.0
levn: 0.4.1
'@fastify/busboy@2.1.1': {}
'@humanfs/core@0.19.1': {}
'@humanfs/node@0.16.6':
@ -6420,6 +6461,10 @@ snapshots:
undici-types@6.20.0: {}
undici@5.28.5:
dependencies:
'@fastify/busboy': 2.1.1
undici@6.21.1: {}
unist-util-is@6.0.0:

View File

@ -5,9 +5,12 @@
import { existsSync } from 'node:fs'
import { cp, readdir, rm, writeFile } from 'node:fs/promises'
import { basename, join } from 'node:path'
import { exit } from 'node:process'
import { env, exit } from 'node:process'
import { setOutput } from '@actions/core'
import { flavorEntries } from '@catppuccin/palette'
import { createVSIX } from '@vscode/vsce'
import { consola } from 'consola'
import packageJson from 'package.json' assert { type: 'json' }
import { build } from 'tsup'
import { compileTheme } from '~/utils/themes'
@ -88,6 +91,13 @@ try {
shims: true,
})
// package .vsix
const packagePath = `${packageJson.name}-${packageJson.version}.vsix`
await createVSIX({ dependencies: false, packagePath })
if (env.GITHUB_ACTIONS) {
setOutput('vsixPath', packagePath)
}
consola.success('Built VSC extension.')
}
catch (error) {