Skip to content

Commit

Permalink
fix(dist): get rid of ci in makefile, make distintion between persona…
Browse files Browse the repository at this point in the history
…l_id and team_id
  • Loading branch information
kewde committed Jan 5, 2022
1 parent 2e177e6 commit 13f9b47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ jobs:
env:
APPLE_EMAIL: ${{ secrets.APPLE_EMAIL }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAMID: ${{ secrets.APPLE_TEAMID }}
APPLE_PERSONAL_ID: ${{ secrets.APPLE_TEAMID }} # APPLE_PERSONAL_ID == APPLE_TEAM_ID for personal accounts
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAMID }}

- name: Upload packages
uses: actions/upload-artifact@v2-preview
Expand Down
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,15 @@ aw-qt/media/logo/logo.icns:
mv build/MyIcon.icns aw-qt/media/logo/logo.icns

dist/ActivityWatch.app: aw-qt/media/logo/logo.icns
pyinstaller --clean --noconfirm --windowed --codesign-identity $$APPLE_TEAMID aw.spec

dist/notarize:
./scripts/notarize.sh
pyinstaller --clean --noconfirm --windowed aw.spec

dist/ActivityWatch.dmg: dist/ActivityWatch.app
pip install dmgbuild
dmgbuild -s scripts/package/dmgbuild-settings.py -D app=dist/ActivityWatch.app "ActivityWatch" dist/ActivityWatch.dmg
# Don't try to run this outside CI, it causes messes in your macos keychain
codesign-dmg: dist/ActivityWatch.dmg
./scripts/ci/import-macos-p12.sh
codesign --verbose -s ActivityWatch --deep dist/ActivityWatch.dmg
codesign --verbose -s ${APPLE_PERSONAL_ID} --deep dist/ActivityWatch.dmg

dist/notarize:
./scripts/notarize.sh

package:
mkdir -p dist/activitywatch
Expand Down
14 changes: 7 additions & 7 deletions scripts/notarize.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

appleid=$APPLE_EMAIL # Email address used for Apple ID
applemail=$APPLE_EMAIL # Email address used for Apple ID
password=$APPLE_PASSWORD # See apps-specific password https://support.apple.com/en-us/HT204397
teamid=$APPLE_TEAMID # Team idenitifer (if single developer, then set to developer identifier)
keychain_profile="activitywatch-$APPLE_TEAMID" # name of the keychain profile to use
teamid=$APPLE_TEAM_ID # Team idenitifer (if single developer, then set to developer identifier)
keychain_profile="activitywatch-$APPLE_PERSONAL_ID" # name of the keychain profile to use
bundleid=net.activitywatch.ActivityWatch # Match aw.spec
app=dist/ActivityWatch.app
dmg=dist/ActivityWatch.dmg
Expand All @@ -12,7 +12,7 @@ dmg=dist/ActivityWatch.dmg
run_notarytool() {
dist=$1
# Setup the credentials for notarization
xcrun notarytool store-credentials $keychain_profile --apple-id $appleid --team-id $teamid --password $password
xcrun notarytool store-credentials $keychain_profile --apple-id $applemail --team-id $teamid --password $password
# Notarize and wait
echo "Notarization: starting for $dist"
echo "Notarization: in progress for $dist"
Expand All @@ -23,13 +23,13 @@ run_notarytool() {
run_altool() {
dist=$1
# Setup the credentials for notarization
xcrun altool --store-password-in-keychain-item $keychain_profile -u $appleid -p $password
xcrun altool --store-password-in-keychain-item $keychain_profile -u $applemail -p $password
# Notarize and wait
echo "Notarization: starting for $dist"
upload=$(xcrun altool --notarize-app -t osx -f $dist --primary-bundle-id $bundleid -u $appleid --password "@keychain:$keychain_profile")
upload=$(xcrun altool --notarize-app -t osx -f $dist --primary-bundle-id $bundleid -u $applemail --password "@keychain:$keychain_profile")
uuid = $(/usr/libexec/PlistBuddy -c "Print :notarization-upload:RequestUUID" $upload)
while true; do
req=$(xcrun altool --notarization-info $uuid -u $appleid -p $password --output-format xml)
req=$(xcrun altool --notarization-info $uuid -u $applemail -p $password --output-format xml)
status=$(/usr/libexec/PlistBuddy -c "Print :notarization-info:Status" $req)
if [ $status != "in progress" ]; then
break
Expand Down

0 comments on commit 13f9b47

Please sign in to comment.