@@ -11,7 +11,11 @@ const rl = readline.createInterface({
1111function execCommand ( command , description ) {
1212 console . log ( `\n🔄 ${ description } ...` ) ;
1313 try {
14- const output = execSync ( command , { encoding : "utf8" , stdio : "inherit" } ) ;
14+ const output = execSync ( command , {
15+ encoding : "utf8" ,
16+ stdio : "inherit" ,
17+ env : { ...process . env } , // Ensure environment variables are passed
18+ } ) ;
1519 console . log ( `✅ ${ description } completed` ) ;
1620 return output ;
1721 } catch ( error ) {
@@ -31,6 +35,21 @@ function askQuestion(question) {
3135async function main ( ) {
3236 console . log ( "🚀 React Query External Sync - Automated Release\n" ) ;
3337
38+ // Check GitHub token availability
39+ if ( ! process . env . GITHUB_TOKEN ) {
40+ console . log ( "⚠️ GITHUB_TOKEN not found in current environment." ) ;
41+ console . log (
42+ "📝 GitHub releases will be skipped, but you can create them manually."
43+ ) ;
44+ console . log (
45+ "💡 To fix this for next time, restart your terminal after setting the token.\n"
46+ ) ;
47+ } else {
48+ console . log (
49+ "✅ GitHub token found - releases will be created automatically\n"
50+ ) ;
51+ }
52+
3453 // Check if there are uncommitted changes
3554 try {
3655 execSync ( "git diff --exit-code" , { stdio : "ignore" } ) ;
@@ -58,9 +77,9 @@ async function main() {
5877 }
5978
6079 console . log ( "\n📦 What type of release is this?" ) ;
61- console . log ( "1. patch (2.2.0 → 2.2.1 ) - Bug fixes" ) ;
62- console . log ( "2. minor (2.2.0 → 2.3.0) - New features" ) ;
63- console . log ( "3. major (2.2.0 → 3.0.0) - Breaking changes" ) ;
80+ console . log ( "1. patch (2.2.1 → 2.2.2 ) - Bug fixes" ) ;
81+ console . log ( "2. minor (2.2.1 → 2.3.0) - New features" ) ;
82+ console . log ( "3. major (2.2.1 → 3.0.0) - Breaking changes" ) ;
6483
6584 const versionType = await askQuestion (
6685 "\n❓ Enter your choice (1/2/3 or patch/minor/major): "
@@ -115,14 +134,25 @@ async function main() {
115134 // Publish to npm
116135 execCommand ( "npm publish" , "Publishing to npm" ) ;
117136
118- // Create GitHub release
119- execCommand ( "npm run github:release" , "Creating GitHub release" ) ;
137+ // Create GitHub release (with better error handling)
138+ if ( process . env . GITHUB_TOKEN ) {
139+ execCommand ( "npm run github:release" , "Creating GitHub release" ) ;
140+ } else {
141+ console . log ( "\n⚠️ Skipping GitHub release (no token available)" ) ;
142+ console . log ( "💡 You can create it manually or restart terminal and run:" ) ;
143+ console . log ( " npm run github:release" ) ;
144+ }
120145
121146 console . log ( "\n🎉 Release completed successfully!" ) ;
122147 console . log ( "✅ Version bumped and committed" ) ;
123148 console . log ( "✅ Changes pushed to git" ) ;
124149 console . log ( "✅ Package published to npm" ) ;
125- console . log ( "✅ GitHub release created" ) ;
150+
151+ if ( process . env . GITHUB_TOKEN ) {
152+ console . log ( "✅ GitHub release created" ) ;
153+ } else {
154+ console . log ( "⚠️ GitHub release skipped (restart terminal to fix)" ) ;
155+ }
126156 } catch ( error ) {
127157 console . error ( "\n❌ Release failed:" , error . message ) ;
128158 process . exit ( 1 ) ;
0 commit comments