diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4dc84de3..c1397ab0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -131,7 +131,7 @@ jobs: p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }} p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - name: Grunt - run: grunt desktop-darwin + run: grunt desktop-darwin ${{ github.repository != 'keeweb/keeweb' && '--skip-sign' || '' }} - name: Upload dmg artifact uses: actions/upload-artifact@v1 with: diff --git a/Gruntfile.js b/Gruntfile.js index 6ca1ca6c..e3cf7ceb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -50,6 +50,7 @@ module.exports = function (grunt) { }; grunt.initConfig({ + noop: { noop: {} }, gitinfo: { branch: { current: { diff --git a/build/tasks/grunt-noop.js b/build/tasks/grunt-noop.js new file mode 100644 index 00000000..21ddddf0 --- /dev/null +++ b/build/tasks/grunt-noop.js @@ -0,0 +1,3 @@ +module.exports = function (grunt) { + grunt.registerMultiTask('noop', 'This is a no-op task', () => {}); +}; diff --git a/build/tasks/grunt-sign-exe.js b/build/tasks/grunt-sign-exe.js index 9099950e..d20726be 100644 --- a/build/tasks/grunt-sign-exe.js +++ b/build/tasks/grunt-sign-exe.js @@ -13,11 +13,7 @@ module.exports = function (grunt) { const opt = this.options(); for (const [file, name] of Object.entries(opt.files)) { - if (!opt.windows && grunt.option('skip-sign')) { - grunt.log.writeln(`Skipped code-signing: ${file}`); - } else { - await signFile(file, name, opt); - } + await signFile(file, name, opt); } done(); diff --git a/grunt.tasks.js b/grunt.tasks.js index fded3eaf..88217c29 100644 --- a/grunt.tasks.js +++ b/grunt.tasks.js @@ -1,4 +1,6 @@ module.exports = function (grunt) { + const sign = !grunt.option('skip-sign'); + grunt.registerTask('build-web-app', [ 'gitinfo', 'clean', @@ -45,17 +47,17 @@ module.exports = function (grunt) { 'copy:desktop-darwin-helper', 'copy:desktop-darwin-installer-helper', 'copy:native-modules-darwin', - 'osx-sign:desktop', - 'notarize:desktop' + sign ? 'osx-sign:desktop' : 'noop', + sign ? 'notarize:desktop' : 'noop' ]); grunt.registerTask('build-desktop-executables-win32', [ 'electron:win32-x64', 'electron:win32-ia32', 'electron:win32-arm64', - 'sign-exe:win32-build-x64', - 'sign-exe:win32-build-ia32', - 'sign-exe:win32-build-arm64', + sign ? 'sign-exe:win32-build-x64' : 'noop', + sign ? 'sign-exe:win32-build-ia32' : 'noop', + sign ? 'sign-exe:win32-build-arm64' : 'noop', 'copy:desktop-windows-helper-x64', 'copy:desktop-windows-helper-ia32', 'copy:desktop-windows-helper-arm64', @@ -89,15 +91,15 @@ module.exports = function (grunt) { 'nsis:win32-un-x64', 'nsis:win32-un-ia32', 'nsis:win32-un-arm64', - 'sign-exe:win32-uninst-x64', - 'sign-exe:win32-uninst-ia32', - 'sign-exe:win32-uninst-arm64', + sign ? 'sign-exe:win32-uninst-x64' : 'noop', + sign ? 'sign-exe:win32-uninst-ia32' : 'noop', + sign ? 'sign-exe:win32-uninst-arm64' : 'noop', 'nsis:win32-x64', 'nsis:win32-ia32', 'nsis:win32-arm64', - 'sign-exe:win32-installer-x64', - 'sign-exe:win32-installer-ia32', - 'sign-exe:win32-installer-arm64', + sign ? 'sign-exe:win32-installer-x64' : 'noop', + sign ? 'sign-exe:win32-installer-ia32' : 'noop', + sign ? 'sign-exe:win32-installer-arm64' : 'noop', 'copy:desktop-win32-dist-x64', 'copy:desktop-win32-dist-ia32', 'copy:desktop-win32-dist-arm64'