@@ -48,63 +48,102 @@ const hasNextGenBuild =
48
48
process . env . NEXT_GEN_BUILD_STATUS === 'success' &&
49
49
fs . existsSync ( 'dist-next/manifest.json' ) ;
50
50
51
- const manifestReplacePaths = [ 'dist/manifest.json' ] ;
52
- const inpageReplacePaths = [ 'dist/inpage/js/inpage.js' ] ;
51
+ const replacementConfig = [
52
+ {
53
+ files : 'dist/manifest.json' ,
54
+ from : '"version": ".*"' ,
55
+ // Remove "-alpha" string from the version in the manifest.
56
+ // Chrome only supports numbers and dots in the version number.
57
+ to : `"version": "<%= _.replace(nextRelease.version, /[^0-9.]/g, '') %>"` ,
58
+ results : [
59
+ {
60
+ file : 'dist/manifest.json' ,
61
+ hasChanged : true ,
62
+ numMatches : 1 ,
63
+ numReplacements : 1 ,
64
+ } ,
65
+ ] ,
66
+ countMatches : true ,
67
+ } ,
68
+ {
69
+ files : 'dist/inpage/js/inpage.js' ,
70
+ from : 'CORE_EXTENSION_VERSION' ,
71
+ // Replace CORE_EXTENSION_VERSION string to the next release number in the inpage.js file
72
+ to : `<%= _.replace(nextRelease.version, /[^0-9.]/g, '') %>` ,
73
+ results : [
74
+ {
75
+ file : 'dist/inpage/js/inpage.js' ,
76
+ hasChanged : true ,
77
+ numMatches : 2 ,
78
+ numReplacements : 2 ,
79
+ } ,
80
+ ] ,
81
+ countMatches : true ,
82
+ } ,
83
+ ] ;
53
84
54
85
if ( hasNextGenBuild ) {
55
- manifestReplacePaths . push ( 'dist-next/manifest.json' ) ;
56
- inpageReplacePaths . push ( 'dist-next/inpage/js/inpage.js' ) ;
86
+ replacementConfig . push (
87
+ {
88
+ files : 'dist-next/manifest.json' ,
89
+ from : '"version": ".*"' ,
90
+ // Remove "-alpha" string from the version in the manifest.
91
+ // Chrome only supports numbers and dots in the version number.
92
+ to : `"version": "<%= _.replace(nextRelease.version, /[^0-9.]/g, '') %>"` ,
93
+ results : [
94
+ {
95
+ file : 'dist-next/manifest.json' ,
96
+ hasChanged : true ,
97
+ numMatches : 1 ,
98
+ numReplacements : 1 ,
99
+ } ,
100
+ ] ,
101
+ countMatches : true ,
102
+ } ,
103
+ {
104
+ files : 'dist-next/inpage/js/inpage.js' ,
105
+ from : 'CORE_EXTENSION_VERSION' ,
106
+ // Replace CORE_EXTENSION_VERSION string to the next release number in the inpage.js file
107
+ to : `<%= _.replace(nextRelease.version, /[^0-9.]/g, '') %>` ,
108
+ results : [
109
+ {
110
+ file : 'dist-next/inpage/js/inpage.js' ,
111
+ hasChanged : true ,
112
+ numMatches : 2 ,
113
+ numReplacements : 2 ,
114
+ } ,
115
+ ] ,
116
+ countMatches : true ,
117
+ } ,
118
+ ) ;
57
119
}
58
120
59
121
const releaseReplaceSetting = [
60
122
'@google/semantic-release-replace-plugin' ,
61
123
{
62
- replacements : [
63
- {
64
- files : manifestReplacePaths ,
65
- from : '"version": ".*"' ,
66
- // Remove "-alpha" string from the version in the manifest.
67
- // Chrome only supports numbers and dots in the version number.
68
- to : `"version": "<%= _.replace(nextRelease.version, /[^0-9.]/g, '') %>"` ,
69
- results : [
70
- {
71
- file : 'dist/manifest.json' ,
72
- hasChanged : true ,
73
- numMatches : 1 ,
74
- numReplacements : 1 ,
75
- } ,
76
- ] ,
77
- countMatches : true ,
78
- } ,
79
- {
80
- files : inpageReplacePaths ,
81
- from : 'CORE_EXTENSION_VERSION' ,
82
- // Replace CORE_EXTENSION_VERSION string to the next release number in the inpage.js file
83
- to : `<%= _.replace(nextRelease.version, /[^0-9.]/g, '') %>` ,
84
- results : [
85
- {
86
- file : 'dist/inpage/js/inpage.js' ,
87
- hasChanged : true ,
88
- numMatches : 2 ,
89
- numReplacements : 2 ,
90
- } ,
91
- ] ,
92
- countMatches : true ,
93
- } ,
94
- ] ,
124
+ replacements : replacementConfig ,
95
125
} ,
96
126
] ;
97
127
128
+ const assets = [
129
+ {
130
+ path : 'builds/avalanche-wallet-extension.zip' ,
131
+ name : 'Avalanche-wallet-extension-${nextRelease.gitTag}.zip' ,
132
+ label : 'Wallet Extension (${nextRelease.gitTag})' ,
133
+ } ,
134
+ ] ;
135
+
136
+ if ( hasNextGenBuild ) {
137
+ assets . push ( {
138
+ path : 'builds/avalanche-wallet-extension-next.zip' ,
139
+ name : 'NextGen-Core-Extension-${nextRelease.gitTag}.zip' ,
140
+ label : '[NextGen] Core Extension (${nextRelease.gitTag})' ,
141
+ } ) ;
142
+ }
98
143
const githubSetting = [
99
144
'@semantic-release/github' ,
100
145
{
101
- assets : [
102
- {
103
- path : 'builds/avalanche-wallet-extension.zip' ,
104
- name : 'Avalanche-wallet-extension-${nextRelease.gitTag}.zip' ,
105
- label : 'Wallet Extension (${nextRelease.gitTag})' ,
106
- } ,
107
- ] ,
146
+ assets,
108
147
failTitle : false ,
109
148
successComment : false ,
110
149
failComment : false ,
@@ -115,7 +154,7 @@ const githubSetting = [
115
154
const execZipSetting = [
116
155
'@semantic-release/exec' ,
117
156
{
118
- prepareCmd : 'yarn zip' ,
157
+ prepareCmd : hasNextGenBuild ? 'yarn zip && yarn zip:next' : 'yarn zip' ,
119
158
} ,
120
159
] ;
121
160
0 commit comments