@@ -11,7 +11,11 @@ const rl = readline.createInterface({
11
11
function execCommand ( command , description ) {
12
12
console . log ( `\n🔄 ${ description } ...` ) ;
13
13
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
+ } ) ;
15
19
console . log ( `✅ ${ description } completed` ) ;
16
20
return output ;
17
21
} catch ( error ) {
@@ -31,6 +35,21 @@ function askQuestion(question) {
31
35
async function main ( ) {
32
36
console . log ( "🚀 React Query External Sync - Automated Release\n" ) ;
33
37
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
+
34
53
// Check if there are uncommitted changes
35
54
try {
36
55
execSync ( "git diff --exit-code" , { stdio : "ignore" } ) ;
@@ -58,9 +77,9 @@ async function main() {
58
77
}
59
78
60
79
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" ) ;
64
83
65
84
const versionType = await askQuestion (
66
85
"\n❓ Enter your choice (1/2/3 or patch/minor/major): "
@@ -115,14 +134,25 @@ async function main() {
115
134
// Publish to npm
116
135
execCommand ( "npm publish" , "Publishing to npm" ) ;
117
136
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
+ }
120
145
121
146
console . log ( "\n🎉 Release completed successfully!" ) ;
122
147
console . log ( "✅ Version bumped and committed" ) ;
123
148
console . log ( "✅ Changes pushed to git" ) ;
124
149
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
+ }
126
156
} catch ( error ) {
127
157
console . error ( "\n❌ Release failed:" , error . message ) ;
128
158
process . exit ( 1 ) ;
0 commit comments