@@ -14,14 +14,51 @@ jobs:
14
14
- name : Checkout Repository
15
15
uses : actions/checkout@v2
16
16
17
+ - name : Install codesign certificate
18
+ env :
19
+ # DEV_CERT_B64: Base64-encoded developer certificate as .p12
20
+ # DEV_CERT_PWD: Developer certificate .p12 password
21
+ # KEYCHAIN_TIMEOUT: Lock keychain after timeout interval
22
+ # https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
23
+ DEV_CERT_B64 : ${{ secrets.DEV_CERT_B64 }}
24
+ DEV_CERT_PWD : ${{ secrets.DEV_CERT_PWD }}
25
+ KEYCHAIN_TIMEOUT : 21600
26
+ run : |
27
+ DEV_CERT_P12="$RUNNER_TEMP/dev_cert.p12"
28
+ KEYCHAIN_DB="$RUNNER_TEMP/keychain.keychain-db"
29
+ KEYCHAIN_PWD=$(openssl rand -base64 24)
30
+ security create-keychain -p "$KEYCHAIN_PWD" "$KEYCHAIN_DB"
31
+ security set-keychain-settings -lut "$KEYCHAIN_TIMEOUT" "$KEYCHAIN_DB"
32
+ security unlock-keychain -p "$KEYCHAIN_PWD" "$KEYCHAIN_DB"
33
+ echo -n "$DEV_CERT_B64" | base64 --decode --output "$DEV_CERT_P12"
34
+ security import "$DEV_CERT_P12" -P "$DEV_CERT_PWD" -A -t cert -f pkcs12 -k "$KEYCHAIN_DB"
35
+ security list-keychain -d user -s "$KEYCHAIN_DB"
36
+
17
37
- name : Building
18
38
run : |
19
39
swift build -c release --arch arm64 --arch x86_64
20
- cd .build/apple/Products/Release/
21
- zip codeedit-cli.zip codeedit-cli
22
- cd ../../../../
23
40
24
- # CODESIGN & NOTARIZE THE BINARY
41
+ - name : Sign
42
+ env :
43
+ CODESIGN_SIGN : ${{ secrets.CODESIGN_SIGN }}
44
+ run : |
45
+ security find-identity -p basic -v
46
+ codesign --sign "$CODESIGN_SIGN" --prefix austincondiff.CodeEdit. --options=runtime --verbose --timestamp .build/apple/Products/Release/codeedit-cli
47
+
48
+ - name : Zip
49
+ run : zip -r .build/apple/Products/Release/codeedit-cli.zip .build/apple/Products/Release/codeedit-cli
50
+
51
+ - name : Notarize
52
+ env :
53
+ APPLE_ID : ${{ secrets.APPLE_ID }}
54
+ APPLE_ID_PWD : ${{ secrets.APPLE_ID_PWD }}
55
+ APPLE_TEAM_ID : ${{ secrets.APPLE_TEAM_ID }}
56
+ run : |
57
+ xcrun notarytool submit ".build/apple/Products/Release/codeedit-cli.zip" --apple-id "$APPLE_ID" --password "$APPLE_ID_PWD" --team-id "$APPLE_TEAM_ID" --verbose --wait --output-format plist > "NotarizationResponse.plist"
58
+ status=`/usr/libexec/PlistBuddy -c "Print :status" "NotarizationResponse.plist"`
59
+ if [[ $status != "Accepted" ]]; then
60
+ exit 999
61
+ fi
25
62
26
63
- name : Create Release
27
64
id : create_release
@@ -33,13 +70,18 @@ jobs:
33
70
release_name : ${{ github.ref }}
34
71
draft : false
35
72
prerelease : false
36
-
73
+
37
74
- name : Upload Release Asset
38
75
uses : actions/upload-release-asset@v1
39
76
env :
40
77
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
41
78
with :
42
79
upload_url : ${{ steps.create_release.outputs.upload_url }}
43
80
asset_path : .build/apple/Products/Release/codeedit-cli.zip
44
- asset_name : codeedit-cli-binary.zip
81
+ asset_name : codeedit-cli-universal- binary.zip
45
82
asset_content_type : application/zip
83
+
84
+ - name : Clean up keychain
85
+ if : ${{ always() }}
86
+ run : |
87
+ security delete-keychain "$RUNNER_TEMP/keychain.keychain-db"
0 commit comments