@@ -17,75 +17,75 @@ const repoUrlPath = 'fomantic/Fomantic-UI'
17
17
const npmBase = 'https://registry.npmjs.org'
18
18
const npmPackage = 'fomantic-ui'
19
19
const currentRev = childProcess // get the current rev from the repo
20
- . execSync ( 'git rev-parse HEAD' )
21
- . toString ( )
22
- . trim ( )
23
- . slice ( 0 , 7 )
20
+ . execSync ( 'git rev-parse HEAD' )
21
+ . toString ( )
22
+ . trim ( )
23
+ . slice ( 0 , 7 )
24
24
25
25
const getNextVersion = async function ( ) {
26
- const versions = await fetch ( `${ ghBase } /repos/${ repoUrlPath } /milestones` )
27
- . then ( r => r . json ( ) )
28
- . then ( milestones => milestones . filter ( m => m . title . indexOf ( 'x' ) === - 1 ) ) // remove all versions with `x` in it
29
- . then ( versions => versions . map ( m => m . title ) ) // create array of versions
30
- . then ( versions => semver . sort ( versions ) )
26
+ const versions = await fetch ( `${ ghBase } /repos/${ repoUrlPath } /milestones` )
27
+ . then ( r => r . json ( ) )
28
+ . then ( milestones => milestones . filter ( m => m . title . indexOf ( 'x' ) === - 1 ) ) // remove all versions with `x` in it
29
+ . then ( versions => versions . map ( m => m . title ) ) // create array of versions
30
+ . then ( versions => semver . sort ( versions ) )
31
31
32
- // Return first entry aka the smallest version in milestones which would therefore
33
- // be the next version
34
- return semver . parse ( versions [ 0 ] )
32
+ // Return first entry aka the smallest version in milestones which would therefore
33
+ // be the next version
34
+ return semver . parse ( versions [ 0 ] )
35
35
}
36
36
37
37
const getPublishedVersion = async function ( ) {
38
- // get the latest published nightly tagged version
39
- return semver . parse (
40
- await fetch ( `${ npmBase } /${ npmPackage } ` )
41
- . then ( r => r . json ( ) )
42
- . then ( p => {
43
- let nightly = p [ 'dist-tags' ] . nightly ?? '' ;
44
- let versionInfo = p . versions [ nightly ] ?? { } ;
45
- let buildCommit = nightly . indexOf ( '+' ) === - 1 && versionInfo . gitHead ? '+' + ( versionInfo . gitHead ?? '' ) . slice ( 0 , 7 ) : '' ;
46
- return nightly + buildCommit ;
47
- } )
48
- )
38
+ // get the latest published nightly tagged version
39
+ return semver . parse (
40
+ await fetch ( `${ npmBase } /${ npmPackage } ` )
41
+ . then ( r => r . json ( ) )
42
+ . then ( p => {
43
+ let nightly = p [ 'dist-tags' ] . nightly ?? '' ;
44
+ let versionInfo = p . versions [ nightly ] ?? { } ;
45
+ let buildCommit = nightly . indexOf ( '+' ) === - 1 && versionInfo . gitHead ? '+' + ( versionInfo . gitHead ?? '' ) . slice ( 0 , 7 ) : '' ;
46
+ return nightly + buildCommit ;
47
+ } )
48
+ )
49
49
}
50
50
51
51
const getNightlyVersion = async function ( ) {
52
- const next = semver . parse ( await getNextVersion ( ) )
53
- const current = semver . parse ( await getPublishedVersion ( ) )
52
+ const next = semver . parse ( await getNextVersion ( ) )
53
+ const current = semver . parse ( await getPublishedVersion ( ) )
54
54
55
- if ( current . build [ 0 ] === currentRev ) {
56
- actions . setOutput ( 'shouldPublish' , false )
55
+ if ( current . build [ 0 ] === currentRev ) {
56
+ actions . setOutput ( 'shouldPublish' , false )
57
57
58
- console . log ( 'No new commits since last publish. Exiting.' )
59
- process . exit ( 0 )
60
- return
61
- }
58
+ console . log ( 'No new commits since last publish. Exiting.' )
59
+ process . exit ( 0 )
60
+ return
61
+ }
62
62
63
- let nightlyVersion = `${ next . version } -beta.0`
63
+ let nightlyVersion = `${ next . version } -beta.0`
64
64
65
- // Check if published version is the same version as next version.
66
- // Only check major, minor and patch as previously published nightly
67
- // versions would include prerelease tag and build metadata
68
- if ( semver . eq ( `${ next . major } .${ next . minor } .${ next . patch } ` , `${ current . major } .${ current . minor } .${ current . patch } ` ) ) {
65
+ // Check if published version is the same version as next version.
66
+ // Only check major, minor and patch as previously published nightly
67
+ // versions would include prerelease tag and build metadata
68
+ if ( semver . eq ( `${ next . major } .${ next . minor } .${ next . patch } ` , `${ current . major } .${ current . minor } .${ current . patch } ` ) ) {
69
69
// If they match then a nightly version has already been published, so we need to increment
70
70
// the prerelease and add the new rev as build metadata
71
- nightlyVersion = semver . inc (
72
- `${ next . version } -beta.${ current . prerelease [ 1 ] } ` ,
73
- 'prerelease'
74
- )
75
- }
71
+ nightlyVersion = semver . inc (
72
+ `${ next . version } -beta.${ current . prerelease [ 1 ] } ` ,
73
+ 'prerelease'
74
+ )
75
+ }
76
76
77
- actions . setOutput ( 'shouldPublish' , 'yes' )
78
- return `${ nightlyVersion } +${ currentRev } `
77
+ actions . setOutput ( 'shouldPublish' , 'yes' )
78
+ return `${ nightlyVersion } +${ currentRev } `
79
79
}
80
80
81
81
getNightlyVersion ( )
82
- . then ( nightlyVersion => {
83
- pkg . version = nightlyVersion
84
- } )
85
- . then ( ( ) => {
86
- fs . writeFileSync (
87
- path . resolve ( __dirname , '../package.json' ) ,
88
- JSON . stringify ( pkg , null , 2 )
89
- )
90
- } )
91
- . then ( ( ) => console . log ( `Done (${ pkg . version } )` ) )
82
+ . then ( nightlyVersion => {
83
+ pkg . version = nightlyVersion
84
+ } )
85
+ . then ( ( ) => {
86
+ fs . writeFileSync (
87
+ path . resolve ( __dirname , '../package.json' ) ,
88
+ JSON . stringify ( pkg , null , 2 )
89
+ )
90
+ } )
91
+ . then ( ( ) => console . log ( `Done (${ pkg . version } )` ) )
0 commit comments