Skip to content

Commit 0191e06

Browse files
committed
Implement reproducible builds for Windows installers
1 parent 324634f commit 0191e06

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

build/installer.nsh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# electron-builder generates temporary files then tells NSIS to generate the
2+
# installer. These files will have unreliable modification times which NSIS
3+
# will save by default, resulting in the installer changing each time it is
4+
# generated. We disable that so that to improve reproducibility.
5+
SetDateSave off

release-automation/build.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ const afterPack = async (context) => {
155155
recursivelySetFileTimes(context.appOutDir, sourceDateEpoch);
156156
};
157157

158+
const afterSign = async (context) => {
159+
// Ensure that modification times are still reproducible after signing and resource
160+
// editing.
161+
recursivelySetFileTimes(context.appOutDir, sourceDateEpoch);
162+
};
163+
158164
const build = async ({
159165
platformName, // String that indexes into Platform[...]
160166
platformType, // Passed as first argument into platform.createTarget(...)
@@ -192,6 +198,7 @@ const build = async ({
192198
tw_update: isProduction && manageUpdates
193199
},
194200
afterPack,
201+
afterSign,
195202
...extraConfig,
196203
...await prepare(archName)
197204
};

0 commit comments

Comments
 (0)