File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,40 +75,20 @@ jobs:
7575 - uses : actions/setup-node@v2
7676 if : matrix.config.kind == 'test_release'
7777 with :
78- node-version : ' 20 .x'
78+ node-version : ' 24 .x'
7979 registry-url : ' https://registry.npmjs.org'
8080
8181 - name : Setup and test npm deployment
8282 if : matrix.config.kind == 'test_release'
8383 run : |
8484 cd deployment/npm
8585 npm install
86- node setup.js ${{ steps.get_tag_version.outputs.TAG_VERSION }}
86+ node setup.js
8787 npm run test
8888
89- - name : npm publish
90- if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'dprint/dprint-plugin-typescript'
91- env :
92- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
93- run : |
94- cd deployment/npm
95- npm publish --access public
96- git reset --hard
97-
98- # CARGO PUBLISH
99- - name : Cargo login
100- if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'dprint/dprint-plugin-typescript'
101- run : cargo login ${{ secrets.CRATES_TOKEN }}
102-
103- - name : Cargo publish
104- if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'dprint/dprint-plugin-typescript'
105- run : cargo publish
106-
10789 # GITHUB RELEASE
108- - uses : denoland/setup-deno@v1
90+ - uses : denoland/setup-deno@v2
10991 if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
110- with :
111- deno-version : v1.x
11292 - name : Pre-release
11393 if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
11494 run : |
Original file line number Diff line number Diff line change 1+ name : publish
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ tags :
7+ - ' *'
8+
9+ permissions :
10+ id-token : write
11+ contents : read
12+
13+ jobs :
14+ cargo :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v6
18+ - uses : dsherret/rust-toolchain-file@v1
19+ - uses : rust-lang/crates-io-auth-action@v1
20+ id : auth
21+ - name : Cargo publish
22+ env :
23+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
24+ run : cargo publish
25+
26+ npm :
27+ runs-on : ubuntu-latest
28+ steps :
29+ - uses : actions/checkout@v6
30+ - uses : dsherret/rust-toolchain-file@v1
31+ - name : Install wasm32 target
32+ run : rustup target add wasm32-unknown-unknown
33+ - name : Build release
34+ run : cargo build --target wasm32-unknown-unknown --features wasm --release
35+ - uses : actions/setup-node@v6
36+ with :
37+ node-version : ' 24.x'
38+ registry-url : ' https://registry.npmjs.org'
39+ - name : Setup and test npm deployment
40+ run : |
41+ cd deployment/npm
42+ npm install
43+ node setup.js sync-version
44+ - name : npm publish
45+ run : |
46+ cd deployment/npm
47+ npm publish --access public
Original file line number Diff line number Diff line change @@ -10,6 +10,16 @@ if (args.length > 0) {
1010 const packageJsonPath = path . join ( __dirname , "package.json" ) ;
1111 const packageJsonText = fs . readFileSync ( packageJsonPath , "utf8" ) ;
1212 const packageJson = JSON . parse ( packageJsonText ) ;
13- packageJson . version = args [ 0 ] ;
13+ if ( args [ 0 ] === "sync-version" ) {
14+ const cargoTomlPath = path . join ( __dirname , "../../Cargo.toml" ) ;
15+ const cargoTomlText = fs . readFileSync ( cargoTomlPath , "utf8" ) ;
16+ const versionMatch = cargoTomlText . match ( / ^ v e r s i o n \s * = \s * " ( [ ^ " ] + ) " / m) ;
17+ if ( ! versionMatch ) {
18+ throw new Error ( "Could not find version in Cargo.toml" ) ;
19+ }
20+ packageJson . version = versionMatch [ 1 ] ;
21+ } else {
22+ packageJson . version = args [ 0 ] ;
23+ }
1424 fs . writeFileSync ( packageJsonPath , JSON . stringify ( packageJson , undefined , 2 ) + "\n" ) ;
1525}
You can’t perform that action at this time.
0 commit comments