Skip to content

Commit 5991f70

Browse files
committed
improve CI
1 parent b86e6b7 commit 5991f70

7 files changed

Lines changed: 61 additions & 50 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
matrix:
1616
deno:
1717
- v1.x
18+
- v2.x
1819
- canary
1920
os:
2021
- ubuntu-22.04
@@ -28,11 +29,11 @@ jobs:
2829
submodules: true
2930

3031
- name: Set up Deno
31-
uses: denoland/setup-deno@v1
32+
uses: denoland/setup-deno@v2
3233
with:
3334
deno-version: ${{ matrix.deno }}
3435

35-
- name: Run tests canary
36+
- name: Run tests
3637
run: deno task test
3738

3839
- name: Generate lcov
@@ -56,7 +57,7 @@ jobs:
5657
persist-credentials: false
5758

5859
- name: Set up Deno
59-
uses: denoland/setup-deno@v1
60+
uses: denoland/setup-deno@v2
6061
with:
6162
deno-version: canary
6263

@@ -65,3 +66,18 @@ jobs:
6566

6667
- name: Lint
6768
run: deno task lint
69+
70+
- name: Build for NPM
71+
run: deno task build
72+
73+
- name: Publish (dry run)
74+
run: deno publish --allow-dirty --dry-run
75+
76+
- name: Set up Node
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: "22.x"
80+
registry-url: "https://registry.npmjs.org"
81+
82+
- name: NPM (dry run)
83+
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 unbuild@2.0.0', { stdio: ['ignore', 'inherit', 'inherit'] })
46+
const builderName = 'unbuild@3.5.0'
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)