@@ -2,15 +2,12 @@ import * as Path from 'path'
22import * as Fs from 'fs'
33
44import { getProductName , getVersion } from '../app/package-info'
5- import { getReleaseBranchName } from './build-platforms'
65
76const productName = getProductName ( )
87const version = getVersion ( )
98
109const projectRoot = Path . join ( __dirname , '..' )
1110
12- const publishChannels = [ 'production' , 'test' , 'beta' ]
13-
1411export function getDistRoot ( ) {
1512 return Path . join ( projectRoot , 'dist' )
1613}
@@ -109,39 +106,11 @@ export function getBundleSizes() {
109106 mainBundleSize : Fs . statSync ( Path . join ( outPath , 'main.js' ) ) . size ,
110107 }
111108}
109+ export const isPublishable = ( ) =>
110+ [ 'production' , 'beta' , 'test' ] . includes ( getChannel ( ) )
112111
113- export function isPublishable ( ) : boolean {
114- const channelFromBranch = getChannelFromBranch ( )
115- return channelFromBranch !== undefined
116- ? publishChannels . includes ( channelFromBranch )
117- : false
118- }
119-
120- export function getChannel ( ) {
121- const channelFromBranch = getChannelFromBranch ( )
122- return channelFromBranch !== undefined
123- ? channelFromBranch
124- : process . env . NODE_ENV || 'development'
125- }
126-
127- function getChannelFromBranch ( ) : string | undefined {
128- // Branch name format: __release-CHANNEL-DEPLOY_ID
129- const pieces = getReleaseBranchName ( ) . split ( '-' )
130- if ( pieces . length < 3 || pieces [ 0 ] !== '__release' ) {
131- return
132- }
133- return pieces [ 1 ]
134- }
135-
136- export function getReleaseSHA ( ) {
137- // Branch name format: __release-CHANNEL-DEPLOY_ID
138- const pieces = getReleaseBranchName ( ) . split ( '-' )
139- if ( pieces . length < 3 || pieces [ 0 ] !== '__release' ) {
140- return null
141- }
142-
143- return pieces [ 2 ]
144- }
112+ export const getChannel = ( ) =>
113+ process . env . RELEASE_CHANNEL ?? process . env . NODE_ENV ?? 'development'
145114
146115export function getDistArchitecture ( ) : 'arm64' | 'x64' {
147116 // If a specific npm_config_arch is set, we use that one instead of the OS arch (to support cross compilation)
0 commit comments