Skip to content

Commit 419d26c

Browse files
committed
Clean up macos notarization and code sign info
1 parent c944125 commit 419d26c

File tree

5 files changed

+19
-81
lines changed

5 files changed

+19
-81
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,25 @@ To support windows code signing the user has to create two certificate files `ap
7777

7878
### MacOS -> DMG
7979

80-
The builds are all done on an x86_64 apple machine and we're enabling rosetta explicitly in the `.plist` file for M1 machines.
80+
MacOS has two variants ARM (M1,2,3...) and legacy x86 if you want to enable your builds on both platforms the easiest way is to have the CI (e.g. GitHub) have the build done on a x86_64 machine. Then the rosetta compatibility layer will make it runnable on ARM too. For this rosetta is enabled explicitly in the `.plist` file for ARM machines.
8181

82-
To run either you will need a macos development account. There are two environment variables this depends on `DEVELOPER_ID` which is set by `build_macos.sh` automatically using the default. `AC_PASSWORD` which is the API key for your account
82+
Code signing is done as part of the `desktop.installer` task if and only if a developer_id is provided. This can be provided through one of these environment variables:
8383

84-
1) `build_macos.sh`
85-
2) `notarize_macos.sh`
84+
- `MACOS_DEVELOPER_ID` - String of the user uid
85+
- `MACOS_PEM` - PEM file with both user uid and user certificate for signing
8686

87-
#### Known Issues / Comments
87+
In addition the keychain to be used can be specified using:
88+
- `MACOS_KEYCHAIN` - Name/path of the keychain defaults to the result of `security login-keychain`
8889

89-
* Background images for the deployment window of the `.dmg` (when clicking that on macos) are hardcoded in the rel/macosx/ subdirectory. I've not yet discovered how to properly (dynamically) create them. Also haven't found out how to set the DMGs icon to be non-standard as some apps do.
9090

91-
* The DMG should be notarized in two phases but right now it's not :-(
91+
1) `mix desktop.installer`
92+
2) `mix desktop.notarize <username@apple_account.com> <app_specific_password> <team_id> _build/prod/*.dmg`
9293

93-
1) Notarize the app directory (by zipping and uploading it)
94-
1) Staple the ticket to the app directory and all executables
95-
1) Package the app directory into the dmg, notarize the dmg
96-
1) Staple the ticket to the dmg
94+
#### Known Issues / Comments
95+
96+
* Background images for the deployment window of the `.dmg` (when clicking that on macos) are hardcoded in the rel/macosx/ subdirectory. I've not yet discovered how to properly (dynamically) create them. Also haven't found out how to set the DMGs icon to be non-standard as some apps do.
9797

98-
* Best to use a really recent wxWidgets on macos, such as wxWidgets (3.1.6) as e.g. taskbar icon size bug fixes are only present there.
98+
* Best to use the most recent wxWidgets on macos, as e.g. taskbar icon size bug fixes are only present there.
9999

100100
### Linux -> makeself
101101

lib/package/macos.ex

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ defmodule Desktop.Deployment.Package.MacOS do
7676
# Maybe embedding Info.plist into the beam.smp
7777
with [beam_smp] <- wildcard(root, "**/*.smp") do
7878
oldbin = File.read!(beam_smp)
79-
with [match] <- Regex.run(~r/<\!--PLIST_TEMPLATE_START_64f5fc2af15ab6092d25ede0fdc039e0789aa6e9.+PLIST_TEMPLATE_END_64f5fc2af15ab6092d25ede0fdc039e0789aa6e9-->/s, oldbin) do
79+
80+
with [match] <-
81+
Regex.run(
82+
~r/<\!--PLIST_TEMPLATE_START_64f5fc2af15ab6092d25ede0fdc039e0789aa6e9.+PLIST_TEMPLATE_END_64f5fc2af15ab6092d25ede0fdc039e0789aa6e9-->/s,
83+
oldbin
84+
) do
8085
size = byte_size(match)
8186
[_all, replacement] = Regex.run(~r/<plist[^>]*>(.+)<\/plist>/s, content)
8287
replacement = String.pad_trailing(replacement, size, " ")
@@ -95,7 +100,7 @@ defmodule Desktop.Deployment.Package.MacOS do
95100
end)
96101
end
97102

98-
developer_id = Package.MacOS.find_developer_id()
103+
developer_id = find_developer_id()
99104

100105
if developer_id != nil do
101106
codesign(root)
@@ -425,45 +430,6 @@ defmodule Desktop.Deployment.Package.MacOS do
425430
end
426431
end
427432

428-
defmodule NtzCreds do
429-
@moduledoc false
430-
defstruct [:username, :password, :team_uid]
431-
end
432-
433-
def notarize(file) do
434-
notarize(Desktop.Deployment.package(), default_creds(), file)
435-
end
436-
437-
def default_creds() do
438-
%NtzCreds{
439-
username: System.get_env("MACOS_NOTARIZATION_USER"),
440-
password: System.get_env("MACOS_NOTARIZATION_PASSWORD"),
441-
team_uid: find_developer_id()
442-
}
443-
end
444-
445-
def notarize(
446-
%Package{identifier: identifier},
447-
%NtzCreds{username: username, password: password, team_uid: team_uid},
448-
file
449-
)
450-
when is_binary(username) and is_binary(password) and is_binary(team_uid) do
451-
cmd!("xcrun", [
452-
"altool",
453-
"--notarize-app",
454-
"--primary-bundle-id",
455-
identifier <> ".dmg",
456-
"--username",
457-
username,
458-
"--password",
459-
password,
460-
"--team",
461-
team_uid,
462-
"--file",
463-
file
464-
])
465-
end
466-
467433
defp scan({:AttributeTypeAndValue, @friendly_attribute, friendly}) do
468434
case Regex.scan(~r/\(([^)]+)\)$/, friendly) do
469435
[[_full, uid]] -> [uid]

notarize_macos.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

notarize_macos_info.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

notarize_macos_list.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)