@@ -16,9 +16,9 @@ const RELEASE_PATTERNS = {
1616
1717const EXIT_CODES = {
1818 SUCCESS : 0 ,
19- NO_RELEASE_FOUND : 1 ,
2019 GIT_ERROR : 2 ,
2120 ENV_ERROR : 3 ,
21+ OUTPUT_ERROR : 4 ,
2222}
2323
2424/**
@@ -38,6 +38,23 @@ function setGitHubEnv(key, value) {
3838 }
3939}
4040
41+ /**
42+ * Write output variable to GitHub Output
43+ * @param {string } key - Output key
44+ * @param {string } value - Output value
45+ */
46+ function setGitHubOutput ( key , value ) {
47+ try {
48+ if ( ! process . env . GITHUB_OUTPUT ) {
49+ return
50+ }
51+ appendFileSync ( process . env . GITHUB_OUTPUT , `${ key } =${ value } \n` )
52+ } catch ( error ) {
53+ console . error ( `Failed to set output variable ${ key } :` , error . message )
54+ process . exit ( EXIT_CODES . OUTPUT_ERROR )
55+ }
56+ }
57+
4158/**
4259 * Get the latest commit message
4360 * @returns {string } Latest commit message
@@ -88,7 +105,7 @@ function main() {
88105
89106 if ( ! releaseInfo ) {
90107 console . info ( "No desktop or mobile release found in commit message." )
91- process . exit ( EXIT_CODES . NO_RELEASE_FOUND )
108+ process . exit ( EXIT_CODES . SUCCESS )
92109 }
93110
94111 const { platform, version, tagName } = releaseInfo
@@ -97,6 +114,9 @@ function main() {
97114 setGitHubEnv ( "tag_version" , tagName )
98115 setGitHubEnv ( "platform" , platform )
99116 setGitHubEnv ( "version" , version )
117+ setGitHubOutput ( "tag_version" , tagName )
118+ setGitHubOutput ( "platform" , platform )
119+ setGitHubOutput ( "version" , version )
100120
101121 console . info ( `Found ${ platform } release: ${ version } ` )
102122 console . info ( `Tag will be created: ${ tagName } ` )
0 commit comments