Skip to content

Commit 33697be

Browse files
committed
ci: publish on CI
1 parent b7b79b8 commit 33697be

File tree

8 files changed

+45
-29
lines changed

8 files changed

+45
-29
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
lint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717

1818
- name: Install pnpm
19-
uses: pnpm/action-setup@v3
19+
uses: pnpm/action-setup@v4
2020

2121
- name: Set node
22-
uses: actions/setup-node@v4
22+
uses: actions/setup-node@v5
2323
with:
2424
node-version: lts/*
2525
cache: pnpm
@@ -36,13 +36,13 @@ jobs:
3636
typecheck:
3737
runs-on: ubuntu-latest
3838
steps:
39-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v5
4040

4141
- name: Install pnpm
42-
uses: pnpm/action-setup@v3
42+
uses: pnpm/action-setup@v4
4343

4444
- name: Set node
45-
uses: actions/setup-node@v4
45+
uses: actions/setup-node@v5
4646
with:
4747
node-version: lts/*
4848
cache: pnpm
@@ -66,13 +66,13 @@ jobs:
6666
fail-fast: false
6767

6868
steps:
69-
- uses: actions/checkout@v4
69+
- uses: actions/checkout@v5
7070

7171
- name: Install pnpm
72-
uses: pnpm/action-setup@v3
72+
uses: pnpm/action-setup@v4
7373

7474
- name: Set node ${{ matrix.node }}
75-
uses: actions/setup-node@v4
75+
uses: actions/setup-node@v5
7676
with:
7777
node-version: ${{ matrix.node }}
7878
cache: pnpm

.github/workflows/release.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
name: Release
22

3-
permissions:
4-
contents: write
5-
63
on:
74
push:
85
tags:
96
- 'v*'
107

118
jobs:
129
release:
10+
permissions:
11+
id-token: write
12+
contents: write
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Install pnpm
20-
uses: pnpm/action-setup@v3
20+
uses: pnpm/action-setup@v4
2121

2222
- name: Set node
23-
uses: actions/setup-node@v4
23+
uses: actions/setup-node@v5
2424
with:
2525
node-version: lts/*
26+
cache: pnpm
27+
registry-url: 'https://registry.npmjs.org'
2628

2729
- run: npx changelogithub
30+
continue-on-error: true
2831
env:
2932
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
33+
34+
- name: Install Dependencies
35+
run: pnpm install
36+
37+
- name: Update npm
38+
run: npm install -g npm@latest
39+
40+
- name: Publish to NPM
41+
run: pnpm publish --no-git-checks

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"test": "vitest",
4343
"lint": "eslint",
4444
"deps": "taze major -I",
45-
"release": "bumpp && pnpm publish --no-git-checks",
45+
"release": "bumpp",
4646
"catalog": "pncat",
4747
"prepare": "simple-git-hooks",
4848
"bootstrap": "pnpm install",

pncat.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export default defineConfig({
77
match: ['yocto-spinner'],
88
},
99
]),
10+
postRun: 'eslint --fix "**/package.json" "**/pnpm-workspace.yaml"',
1011
})

pnpm-workspace.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ catalogs:
2626
vitest: ^3.2.4
2727
types:
2828
'@types/node': ^24.9.1
29+
onlyBuiltDependencies:
30+
- esbuild
31+
- simple-git-hooks

src/cli.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { execa } from 'execa'
88
import { name, version } from '../package.json'
99
import { resolveConfig } from './config'
1010
import { PLATFORM_CHOICES } from './constants'
11-
import { executeWithFeedback } from './utils'
11+
import { runWithRetry } from './utils'
1212

1313
try {
1414
const cli: CAC = cac('vsxpub')
@@ -103,7 +103,7 @@ async function execCommand(cmd: string, args: string[], config: PublishOptions)
103103

104104
async function createPackage(config: PublishOptions) {
105105
const args = normalizeArgs(['vsce', 'package'], config)
106-
return await executeWithFeedback({
106+
return await runWithRetry({
107107
config,
108108
message: 'Creating .vsix package...',
109109
successMessage: 'Created .vsix package.',
@@ -119,7 +119,7 @@ async function createPackage(config: PublishOptions) {
119119

120120
async function publishToVsce(vsix: string, config: PublishOptions) {
121121
const exec = async (args: string[]) => {
122-
return await executeWithFeedback({
122+
return await runWithRetry({
123123
config,
124124
message: 'Publishing to visual studio code marketplace...',
125125
successMessage: 'Published to visual studio code marketplace.',
@@ -143,7 +143,7 @@ async function publishToVsce(vsix: string, config: PublishOptions) {
143143

144144
async function publishToOvsx(vsix: string, config: PublishOptions) {
145145
const args = normalizeArgs(['ovsx', 'publish', vsix], config)
146-
return await executeWithFeedback({
146+
return await runWithRetry({
147147
config,
148148
message: 'Publishing to open vsx registry...',
149149
successMessage: 'Published to open vsx registry.',
@@ -159,7 +159,7 @@ async function publishToOvsx(vsix: string, config: PublishOptions) {
159159

160160
async function publishToGit(vsix: string, config: PublishOptions) {
161161
const args = ['release', 'upload', config.tag, vsix, '--repo', config.repo, '--clobber']
162-
return await executeWithFeedback({
162+
return await runWithRetry({
163163
config,
164164
message: 'Uploading .vsix to github release page...',
165165
successMessage: 'Uploaded .vsix to github release page.',

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MaybePromise, PublishOptions } from './types'
33
import c from 'ansis'
44
import Spinner from 'yocto-spinner'
55

6-
export async function executeWithFeedback(options: {
6+
export async function runWithRetry(options: {
77
config: PublishOptions
88
message: string
99
successMessage: string

test/retry.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PublishOptions } from '../src/types'
22
import { describe, expect, it, vi } from 'vitest'
33
import { DEFAULT_PUBLISH_OPTIONS } from '../src/constants'
4-
import { executeWithFeedback } from '../src/utils'
4+
import { runWithRetry } from '../src/utils'
55

66
const publisOptions: PublishOptions = {
77
...DEFAULT_PUBLISH_OPTIONS,
@@ -17,11 +17,11 @@ const publisOptions: PublishOptions = {
1717
ovsxPat: 'ovsx-pat',
1818
}
1919

20-
describe('executeWithFeedback', () => {
20+
describe('runWithRetry', () => {
2121
it('should execute function successfully', async () => {
2222
const mockFn = vi.fn().mockResolvedValue(undefined)
2323

24-
const result = await executeWithFeedback({
24+
const result = await runWithRetry({
2525
config: publisOptions,
2626
message: 'Testing...',
2727
successMessage: 'Success!',
@@ -37,7 +37,7 @@ describe('executeWithFeedback', () => {
3737
const mockFn = vi.fn()
3838
const mockDryFn = vi.fn().mockResolvedValue(undefined)
3939

40-
const result = await executeWithFeedback({
40+
const result = await runWithRetry({
4141
config: { ...publisOptions, dry: true },
4242
message: 'Testing...',
4343
successMessage: 'Dry Run Success!',
@@ -57,7 +57,7 @@ describe('executeWithFeedback', () => {
5757
.mockRejectedValueOnce(new Error('Second failure'))
5858
.mockResolvedValueOnce(undefined)
5959

60-
const result = await executeWithFeedback({
60+
const result = await runWithRetry({
6161
config: { ...publisOptions, retry: 2, retryDelay: 10 },
6262
message: 'Testing...',
6363
successMessage: 'Success!',
@@ -75,7 +75,7 @@ describe('executeWithFeedback', () => {
7575
.mockRejectedValueOnce(new Error('Second failure'))
7676
.mockRejectedValueOnce(new Error('Third failure'))
7777

78-
const result = await executeWithFeedback({
78+
const result = await runWithRetry({
7979
config: { ...publisOptions, retry: 2, retryDelay: 10 },
8080
message: 'Testing...',
8181
successMessage: 'Success!',
@@ -90,7 +90,7 @@ describe('executeWithFeedback', () => {
9090
it('should not retry when retryCount is not provided', async () => {
9191
const mockFn = vi.fn().mockRejectedValue(new Error('Error'))
9292

93-
const result = await executeWithFeedback({
93+
const result = await runWithRetry({
9494
config: { ...publisOptions, retry: 0 },
9595
message: 'Testing...',
9696
successMessage: 'Success!',

0 commit comments

Comments
 (0)