Skip to content

Commit da7c78b

Browse files
committed
fix: handle status bar override on windows builds
1 parent a9ab440 commit da7c78b

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

.github/workflows/release-electron.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,32 +90,31 @@ jobs:
9090
});
9191
9292
updateFile('packages/bruno-app/src/components/StatusBar/index.js', (content) => {
93-
if (content.includes('releaseTag ? `v${version}/${releaseTag}`')) {
93+
const releaseMarker = 'releaseTag ? `v${version}/${releaseTag}` : `v${version}`';
94+
if (content.includes(releaseMarker)) {
9495
return content;
9596
}
9697
const anchor = ' const { version } = useApp();';
9798
if (!content.includes(anchor)) {
9899
throw new Error('Unable to find StatusBar version anchor');
99100
}
100-
let updated = content.replace(anchor, `${anchor}\n const releaseTag = ${JSON.stringify(tag)};`);
101+
const newline = content.includes('\r\n') ? '\r\n' : '\n';
102+
let updated = content.replace(anchor, `${anchor}${newline} const releaseTag = ${JSON.stringify(tag)};`);
101103
102-
const originalBlock = [
103-
' <div className="status-bar-version">',
104-
' v{version}',
105-
' </div>'
106-
].join('\n');
107-
108-
if (!updated.includes(originalBlock)) {
104+
const versionBlockPattern = /([ \t]*)<div className="status-bar-version">\r?\n\1 v\{version\}\r?\n\1<\/div>/;
105+
if (!versionBlockPattern.test(updated)) {
109106
throw new Error('Unable to locate StatusBar version markup');
110107
}
111108
112-
const replacementBlock = [
113-
' <div className="status-bar-version">',
114-
' {releaseTag ? `v${version}/${releaseTag}` : `v${version}`}',
115-
' </div>'
116-
].join('\n');
109+
updated = updated.replace(versionBlockPattern, (_, indent) => {
110+
return [
111+
`${indent}<div className="status-bar-version">`,
112+
`${indent} {${releaseMarker}}`,
113+
`${indent}</div>`
114+
].join(newline);
115+
});
117116
118-
return updated.replace(originalBlock, replacementBlock);
117+
return updated;
119118
});
120119
121120
if (!tag) {

0 commit comments

Comments
 (0)