Skip to content

Commit e7f288a

Browse files
committed
improve CI
1 parent b86e6b7 commit e7f288a

File tree

7 files changed

+61
-54
lines changed

7 files changed

+61
-54
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
deno:
17-
- v1.x
18-
- canary
17+
- v2.x
1918
os:
2019
- ubuntu-22.04
2120
- windows-2022
@@ -28,11 +27,11 @@ jobs:
2827
submodules: true
2928

3029
- name: Set up Deno
31-
uses: denoland/setup-deno@v1
30+
uses: denoland/setup-deno@v2
3231
with:
3332
deno-version: ${{ matrix.deno }}
3433

35-
- name: Run tests canary
34+
- name: Run tests
3635
run: deno task test
3736

3837
- name: Generate lcov
@@ -56,12 +55,25 @@ jobs:
5655
persist-credentials: false
5756

5857
- name: Set up Deno
59-
uses: denoland/setup-deno@v1
60-
with:
61-
deno-version: canary
58+
uses: denoland/setup-deno@v2
6259

6360
- name: Format
6461
run: deno fmt --check
6562

6663
- name: Lint
6764
run: deno task lint
65+
66+
- name: Build for NPM
67+
run: deno task build
68+
69+
- name: Publish (dry run)
70+
run: deno publish --allow-dirty --dry-run
71+
72+
- name: Set up Node
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: "22.x"
76+
registry-url: "https://registry.npmjs.org"
77+
78+
- name: NPM (dry run)
79+
run: npm publish --dry-run

.github/workflows/publish.yml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: publish
33
on:
44
push:
55
branches: [main]
6-
release:
7-
types: [published]
86

97
jobs:
108
publish:
@@ -20,37 +18,32 @@ jobs:
2018
uses: actions/checkout@v4
2119

2220
- name: Set up Deno
23-
uses: denoland/setup-deno@v1
21+
uses: denoland/setup-deno@v2
2422

2523
- name: Format
2624
run: deno fmt
2725

2826
- name: Type check
2927
run: deno task test
3028

31-
- name: Publish (dry run)
32-
if: github.event_name == 'push'
33-
run: deno publish --allow-dirty --dry-run
29+
- name: Build for NPM
30+
run: deno task build
3431

3532
- name: Publish (real)
36-
if: github.event_name == 'release'
3733
run: deno publish --allow-dirty
3834

39-
- name: Build for NPM
40-
run: deno task build
41-
42-
- name: Set up Node
43-
uses: actions/setup-node@v4
35+
- name: NPM (real)
36+
id: publish
37+
uses: JS-DevTools/npm-publish@v3
4438
with:
45-
node-version: '20.x'
46-
registry-url: 'https://registry.npmjs.org'
47-
48-
- name: NPM (dry run)
49-
if: github.event_name == 'push'
50-
run: npm publish --dry-run
39+
token: ${{secrets.NPM_TOKEN}}
40+
access: public
41+
provenance: true
5142

52-
- name: NPM (real)
53-
if: github.event_name == 'release'
54-
run: npm publish --provenance --access public
55-
env:
56-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
43+
- name: Release on GitHub
44+
if: ${{ steps.publish.outputs.type }}
45+
uses: softprops/action-gh-release@v1
46+
with:
47+
tag_name: v${{ steps.publish.outputs.version }}
48+
draft: false
49+
generate_release_notes: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ npm install @yieldray/json-rpc-ts
2323
For Deno
2424

2525
```sh
26-
deno add @yieldray/json-rpc-ts
26+
deno add jsr:@yieldray/json-rpc-ts
2727
```
2828

2929
# Examples

build.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { execSync } from 'node:child_process'
2-
31
const pkg = JSON.parse(Deno.readTextFileSync('./deno.json'))
42

53
try {
@@ -45,5 +43,11 @@ Deno.writeTextFileSync('./package.json', JSON.stringify(packageJson, null, 4))
4543
console.log('New package.json created.')
4644
console.log(packageJson)
4745

48-
console.log('Building package using unbuild...')
49-
execSync('npx -y [email protected]', { stdio: ['ignore', 'inherit', 'inherit'] })
46+
const builderName = '[email protected]'
47+
console.log(`Building package using ${builderName}...`)
48+
new Deno.Command('npx', {
49+
args: ['-y', builderName],
50+
stdin: 'null',
51+
stdout: 'inherit',
52+
stderr: 'inherit',
53+
}).spawn()

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"useUnknownInCatchVariables": true,
2121
"noImplicitOverride": true
2222
},
23-
"imports": { "@std/assert": "jsr:@std/assert@^1.0.6" },
23+
"imports": { "@std/assert": "jsr:@std/assert@^1.0.13" },
2424
"tasks": {
2525
"lint": "deno lint",
2626
"fmt": "deno fmt",

deno.lock

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

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"strict": true,
1515
"target": "esnext",
1616
"useDefineForClassFields": true,
17-
"allowImportingTsExtensions": true
17+
"allowImportingTsExtensions": true,
18+
"noEmit": true
1819
}
1920
}

0 commit comments

Comments
 (0)