Skip to content

Commit afa77b2

Browse files
authored
Merge branch 'main' into fix/16-syntax-adjustments
2 parents 85b7d81 + 9278039 commit afa77b2

File tree

1 file changed

+50
-5
lines changed

1 file changed

+50
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,54 @@ jobs:
1414
- name: Checkout Repository
1515
uses: actions/checkout@v2
1616

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+
1737
- name: Building
1838
run: |
1939
swift build -c release --arch arm64 --arch x86_64
20-
cd .build/apple/Products/Release/
21-
zip codeedit-cli.zip codeedit-cli
40+
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: |
50+
cd .build/apple/Products/Release
51+
zip -r codeedit-cli.zip codeedit-cli
2252
cd ../../../../
2353
24-
# CODESIGN & NOTARIZE THE BINARY
54+
- name: Notarize
55+
env:
56+
APPLE_ID: ${{ secrets.APPLE_ID }}
57+
APPLE_ID_PWD: ${{ secrets.APPLE_ID_PWD }}
58+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
59+
run: |
60+
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"
61+
status=`/usr/libexec/PlistBuddy -c "Print :status" "NotarizationResponse.plist"`
62+
if [[ $status != "Accepted" ]]; then
63+
exit 999
64+
fi
2565
2666
- name: Create Release
2767
id: create_release
@@ -33,13 +73,18 @@ jobs:
3373
release_name: ${{ github.ref }}
3474
draft: false
3575
prerelease: false
36-
76+
3777
- name: Upload Release Asset
3878
uses: actions/upload-release-asset@v1
3979
env:
4080
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4181
with:
4282
upload_url: ${{ steps.create_release.outputs.upload_url }}
4383
asset_path: .build/apple/Products/Release/codeedit-cli.zip
44-
asset_name: codeedit-cli-binary.zip
84+
asset_name: codeedit-cli-universal-binary.zip
4585
asset_content_type: application/zip
86+
87+
- name: Clean up keychain
88+
if: ${{ always() }}
89+
run: |
90+
security delete-keychain "$RUNNER_TEMP/keychain.keychain-db"

0 commit comments

Comments
 (0)