@@ -5,34 +5,35 @@ const fs = require("fs");
55const path = require ( "path" ) ;
66const packageJson = require ( path . resolve ( __dirname , "package.json" ) ) ;
77if ( process . env . TOKEN ) {
8- const { Octokit } = require ( "octokit" ) ;
9- // Octokit.js
10- // https://github.com/octokit/core.js#readme
11- const octokit = new Octokit ( {
12- auth : process . env . TOKEN ,
13- } ) ;
8+ import ( "octokit" ) . then ( ( { Octokit } ) => {
9+ // Octokit.js
10+ // https://github.com/octokit/core.js#readme
11+ const octokit = new Octokit ( {
12+ auth : process . env . TOKEN ,
13+ } ) ;
1414
15- const octoOptions = {
16- owner : process . env . OWNER ,
17- repo : process . env . REPO ,
18- headers : {
19- "X-GitHub-Api-Version" : "2022-11-28" ,
20- } ,
21- } ;
22- const tag_name = `v${ packageJson . version } ` ;
23- const name = `Release ${ tag_name } ` ;
24- /** Create a release */
25- octokit . request ( "POST /repos/{owner}/{repo}/releases" , {
26- ...octoOptions ,
27- tag_name,
28- target_commitish : "main" ,
29- name,
30- draft : false ,
31- prerelease : false ,
32- generate_release_notes : true ,
33- headers : {
34- "X-GitHub-Api-Version" : "2022-11-28" ,
35- } ,
15+ const octoOptions = {
16+ owner : process . env . OWNER ,
17+ repo : process . env . REPO ,
18+ headers : {
19+ "X-GitHub-Api-Version" : "2022-11-28" ,
20+ } ,
21+ } ;
22+ const tag_name = `v${ packageJson . version } ` ;
23+ const name = `Release ${ tag_name } ` ;
24+ /** Create a release */
25+ octokit . request ( "POST /repos/{owner}/{repo}/releases" , {
26+ ...octoOptions ,
27+ tag_name,
28+ target_commitish : "main" ,
29+ name,
30+ draft : false ,
31+ prerelease : false ,
32+ generate_release_notes : true ,
33+ headers : {
34+ "X-GitHub-Api-Version" : "2022-11-28" ,
35+ } ,
36+ } ) ;
3637 } ) ;
3738}
3839
0 commit comments