mirror of
https://github.com/samschott/maestral.git
synced 2024-09-22 11:27:35 +03:00
move building to github actions
This commit is contained in:
parent
37883511a5
commit
9d9542562c
96
.github/workflows/build.yml
vendored
Normal file
96
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
schedule:
|
||||
- cron: "19 3 * * *" # everyday at 03:19
|
||||
|
||||
jobs:
|
||||
build_macos:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Import signing certificate into keychain
|
||||
run: |
|
||||
KEYCHAIN_FILE=default.keychain
|
||||
KEYCHAIN_PASSWORD=myvoiceismypassport
|
||||
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_FILE
|
||||
security default-keychain -s $KEYCHAIN_FILE
|
||||
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_FILE
|
||||
security import <(echo $SIGNING_CERTIFICATE_P12_DATA | base64 --decode) \
|
||||
-f pkcs12 \
|
||||
-k $KEYCHAIN_FILE \
|
||||
-P $SIGNING_CERTIFICATE_PASSWORD \
|
||||
-T /usr/bin/codesign \
|
||||
-T /usr/bin/security
|
||||
security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN_FILE
|
||||
security find-identity -v
|
||||
env:
|
||||
SIGNING_CERTIFICATE_P12_DATA: ${{ secrets.SIGNING_CERTIFICATE_P12_DATA }}
|
||||
SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
|
||||
|
||||
- name: Install dependencies
|
||||
# We build the PyInstaller bootloader from source with a deployment target of
|
||||
# macOS 10.13 to get dark mode support etc.
|
||||
run: |
|
||||
git clone https://github.com/pyinstaller/pyinstaller.git package/build/pyinstaller
|
||||
cd package/build/pyinstaller
|
||||
git apply ../../patch/pyinstaller_macos_11.patch
|
||||
cd bootloader
|
||||
python3 ./waf all
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade dmgbuild
|
||||
python -m pip install package/build/pyinstaller
|
||||
python -m pip install .[gui]
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.14
|
||||
CFLAGS: -mmacosx-version-min=10.14
|
||||
CPPFLAGS: -mmacosx-version-min=10.14
|
||||
LDFLAGS: -mmacosx-version-min=10.14
|
||||
LINKFLAGS: -mmacosx-version-min=10.14
|
||||
|
||||
- name: Build app
|
||||
shell: bash --noprofile --norc -eo pipefail {0}
|
||||
run: |
|
||||
cd package
|
||||
python -m PyInstaller -y --clean -w maestral_macos.spec
|
||||
cp bin/maestral_cli dist/Maestral.app/Contents/MacOS/maestral_cli
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
xattr -cr package/dist/Maestral.app
|
||||
codesign --sign "Developer ID Application: Sam Schott" \
|
||||
--entitlements package/entitlements.plist \
|
||||
--options runtime \
|
||||
--force --deep package/dist/Maestral.app
|
||||
codesign --verify --deep package/dist/Maestral.app
|
||||
|
||||
- name: Create dmg
|
||||
run: |
|
||||
cd package/dist
|
||||
dmgbuild -s ../dmg_settings.py Maestral Maestral.dmg
|
||||
codesign --sign "Developer ID Application: Sam Schott" Maestral.dmg
|
||||
codesign --verify Maestral.dmg
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: Notarize app
|
||||
run: |
|
||||
npx notarize-cli --bundle-id "com.samschott.maestral" \
|
||||
--file "package/dist/Maestral.dmg"
|
||||
env:
|
||||
NOTARIZE_USERNAME: ${{ secrets.NOTARIZE_USERNAME }}
|
||||
NOTARIZE_PASSWORD: ${{ secrets.NOTARIZE_PASSWORD }}
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dmg
|
||||
path: package/dist/Maestral.dmg
|
@ -152,12 +152,11 @@ Relevant resources are:
|
||||
If you are using the macOS app bundle, please consider sponsoring the project with £1 per
|
||||
month to offset the cost of an Apple Develper account to sign and notiarize the bundle.
|
||||
|
||||
## Dependencies
|
||||
## System requirements
|
||||
|
||||
- macOS (10.13 or higher for binary) or Linux
|
||||
- macOS (10.14 or higher for binary) or Linux
|
||||
- Python 3.6 or higher
|
||||
- For the GUI only:
|
||||
- PyQt 5.9 or higher
|
||||
- For the system tray icon on Linux:
|
||||
- [gnome-shell-extension-appindicator](https://github.com/ubuntu/gnome-shell-extension-appindicator)
|
||||
on Gnome 3.26 and higher
|
||||
|
||||
@ -168,4 +167,3 @@ month to offset the cost of an Apple Develper account to sign and notiarize the
|
||||
- Error reporting is powered by bugsnag:
|
||||
|
||||
<a href="https://bugsnag.com"> <img src="https://global-uploads.webflow.com/5c741219fd0819540590e785/5c741219fd0819856890e790_asset%2039.svg" title="Bugsnag text" height="20"></a>
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Flags:
|
||||
# --dev: build from dev branch instead of master
|
||||
# --clean: clean build cache and donwnload from github
|
||||
|
||||
stringContain() { [ -z "$1" ] || { [ -z "${2##*$1*}" ] && [ -n "$2" ];};}
|
||||
|
||||
ARGS="$@"
|
||||
SPEC_FILE=maestral_linux.spec
|
||||
|
||||
if stringContain "--dev" "$ARGS"; then
|
||||
BRANCH="develop"
|
||||
else
|
||||
BRANCH="master"
|
||||
fi
|
||||
|
||||
echo "**** INSTALLING DEPENDENCIES ****************************"
|
||||
|
||||
if stringContain "--clean" "$ARGS"; then
|
||||
rm -r -f build
|
||||
mkdir build
|
||||
fi
|
||||
|
||||
python3 -m pip install -U pyinstaller
|
||||
|
||||
git clone https://github.com/samschott/maestral build/maestral
|
||||
cd build/maestral
|
||||
git checkout $BRANCH
|
||||
git pull
|
||||
python3 -m pip install .
|
||||
cd ../..
|
||||
|
||||
git clone https://github.com/samschott/maestral-qt build/maestral-qt
|
||||
cd build/maestral-qt
|
||||
git checkout $BRANCH
|
||||
git pull
|
||||
python3 -m pip install .
|
||||
cd ../..
|
||||
|
||||
echo "**** BUILDING *******************************************"
|
||||
|
||||
python3 -m PyInstaller -y --clean -w $SPEC_FILE
|
||||
|
||||
echo "**** RUNNING POST-BUILD SCRIPTS *************************"
|
||||
|
||||
# pass
|
||||
|
||||
echo "**** SIGNING ********************************************"
|
||||
|
||||
# todo
|
||||
|
||||
echo "**** DONE ***********************************************"
|
@ -1,103 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Flags:
|
||||
# --dev: build from dev branch instead of master
|
||||
# --clean: clean build cache and donwnload from github
|
||||
# --notarize: submit to Apple notary service
|
||||
|
||||
|
||||
stringContain() { [ -z "$1" ] || { [ -z "${2##*$1*}" ] && [ -n "$2" ];};}
|
||||
|
||||
ARGS="$@"
|
||||
SPEC_FILE=maestral_macos.spec
|
||||
BUILD_NO=$(grep -E -o "[0-9]*" bundle_version_macos.txt)
|
||||
|
||||
if stringContain "--dev" "$ARGS"; then
|
||||
echo "**** BUILDING FROM DEV *********************************"
|
||||
BRANCH="develop"
|
||||
else
|
||||
echo "**** BUILDING FROM MASTER ******************************"
|
||||
BRANCH="master"
|
||||
fi
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.13
|
||||
export CFLAGS=-mmacosx-version-min=10.13
|
||||
export CPPFLAGS=-mmacosx-version-min=10.13
|
||||
export LDFLAGS=-mmacosx-version-min=10.13
|
||||
export LINKFLAGS=-mmacosx-version-min=10.13
|
||||
|
||||
echo "**** INSTALLING DEPENDENCIES ***************************"
|
||||
|
||||
if stringContain "--clean" "$ARGS"; then
|
||||
echo "cleaning build dir"
|
||||
rm -r -f build
|
||||
mkdir build
|
||||
fi
|
||||
|
||||
git clone https://github.com/pyinstaller/pyinstaller.git build/pyinstaller
|
||||
cd build/pyinstaller
|
||||
git checkout master
|
||||
git pull
|
||||
git apply ../../patch/pyinstaller_macos_11.patch
|
||||
cd bootloader
|
||||
python3 ./waf all
|
||||
cd ..
|
||||
python3 -m pip install .
|
||||
cd ../..
|
||||
|
||||
git clone https://github.com/samschott/maestral build/maestral
|
||||
cd build/maestral
|
||||
git checkout $BRANCH
|
||||
git pull
|
||||
python3 -m pip install .
|
||||
cd ../..
|
||||
|
||||
git clone https://github.com/samschott/maestral-cocoa build/maestral-cocoa
|
||||
cd build/maestral-cocoa
|
||||
git checkout $BRANCH
|
||||
git pull
|
||||
python3 -m pip install .
|
||||
cd ../..
|
||||
|
||||
echo "**** BUILD NUMBER $BUILD_NO ****************************"
|
||||
|
||||
python3 -m PyInstaller -y --clean -w $SPEC_FILE
|
||||
|
||||
echo "**** COPY CLI ENTRY POINT ******************************"
|
||||
|
||||
cp bin/maestral_cli dist/Maestral.app/Contents/MacOS/maestral_cli
|
||||
|
||||
echo "**** SIGNING APP ***************************************"
|
||||
|
||||
echo "removing xattr"
|
||||
xattr -cr dist/Maestral.app
|
||||
|
||||
echo "signing app"
|
||||
codesign -s "Developer ID Application: Sam Schott" \
|
||||
--entitlements entitlements.plist -f --deep -o runtime dist/Maestral.app
|
||||
|
||||
echo "**** CREATING DMG **************************************"
|
||||
|
||||
test -f dist/Maestral.dmg && rm dist/Maestral.dmg
|
||||
|
||||
create-dmg \
|
||||
--volname "Maestral" \
|
||||
--window-size 300 150 \
|
||||
--icon-size 64 \
|
||||
--text-size 11 \
|
||||
--icon "Maestral.app" 75 75 \
|
||||
--app-drop-link 225 75 \
|
||||
"dist/Maestral.dmg" \
|
||||
"dist/Maestral.app"
|
||||
|
||||
echo "signing dmg"
|
||||
codesign --verify --sign "Developer ID Application: Sam Schott" dist/Maestral.dmg
|
||||
|
||||
|
||||
|
||||
if stringContain "--notarize" "$ARGS"; then
|
||||
echo "**** NOTARISING DMG ************************************"
|
||||
./macos-notarize-dmg.sh dist/Maestral.dmg
|
||||
fi
|
||||
|
||||
echo "**** DONE **********************************************"
|
85
package/dmg_settings.py
Normal file
85
package/dmg_settings.py
Normal file
@ -0,0 +1,85 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import biplist
|
||||
import os.path
|
||||
|
||||
# .. Useful stuff ..............................................................
|
||||
|
||||
application = defines.get('app', 'Maestral.app')
|
||||
appname = os.path.basename(application)
|
||||
|
||||
def icon_from_app(app_path):
|
||||
plist_path = os.path.join(app_path, 'Contents', 'Info.plist')
|
||||
plist = biplist.readPlist(plist_path)
|
||||
icon_name = plist['CFBundleIconFile']
|
||||
icon_root,icon_ext = os.path.splitext(icon_name)
|
||||
if not icon_ext:
|
||||
icon_ext = '.icns'
|
||||
icon_name = icon_root + icon_ext
|
||||
return os.path.join(app_path, 'Contents', 'Resources', icon_name)
|
||||
|
||||
# .. Basics ....................................................................
|
||||
|
||||
# Uncomment to override the output filename
|
||||
# filename = 'test.dmg'
|
||||
|
||||
# Uncomment to override the output volume name
|
||||
# volume_name = 'Test'
|
||||
|
||||
# Volume format (see hdiutil create -help)
|
||||
format = defines.get('format', 'UDBZ')
|
||||
|
||||
# Volume size
|
||||
size = defines.get('size', None)
|
||||
|
||||
# Files to include
|
||||
files = [ application ]
|
||||
|
||||
# Symlinks to create
|
||||
symlinks = { 'Applications': '/Applications' }
|
||||
|
||||
# Volume icon
|
||||
#
|
||||
# You can either define icon, in which case that icon file will be copied to the
|
||||
# image, *or* you can define badge_icon, in which case the icon file you specify
|
||||
# will be used to badge the system's Removable Disk icon
|
||||
|
||||
badge_icon = icon_from_app(application)
|
||||
|
||||
# Where to put the icons
|
||||
icon_locations = {
|
||||
appname: (75, 75),
|
||||
'Applications': (226, 75)
|
||||
}
|
||||
|
||||
# .. Window configuration ......................................................
|
||||
|
||||
show_status_bar = False
|
||||
show_tab_view = False
|
||||
show_toolbar = False
|
||||
show_pathbar = False
|
||||
show_sidebar = False
|
||||
sidebar_width = 180
|
||||
|
||||
# Window position in ((x, y), (w, h)) format
|
||||
window_rect = ((600, 600), (300, 150))
|
||||
default_view = 'icon-view'
|
||||
|
||||
# General view configuration
|
||||
show_icon_preview = False
|
||||
|
||||
# Set these to True to force inclusion of icon/list view settings (otherwise
|
||||
# we only include settings for the default view)
|
||||
include_icon_view_settings = 'auto'
|
||||
include_list_view_settings = 'auto'
|
||||
|
||||
# .. Icon view configuration ...................................................
|
||||
|
||||
arrange_by = None
|
||||
grid_offset = (0, 0)
|
||||
grid_spacing = 100
|
||||
scroll_position = (0, 0)
|
||||
label_pos = 'bottom'
|
||||
text_size = 12
|
||||
icon_size = 64
|
@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Specify dmg as first parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$APPLE_ID_USER" ] || [ -z "$APPLE_ID_PASSWORD" ]; then
|
||||
echo "You need to set your Apple ID credentials with \$APPLE_ID_USER and \$APPLE_ID_PASSWORD."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP_BUNDLE=$(basename "$1")
|
||||
APP_BUNDLE_DIR=$(dirname "$1")
|
||||
|
||||
cd "$APP_BUNDLE_DIR" || exit 1
|
||||
|
||||
# Submit for notarization
|
||||
TMPFILE=$(mktemp)
|
||||
|
||||
echo "Submitting $APP_BUNDLE for notarization..."
|
||||
xcrun altool --notarize-app --type osx \
|
||||
--file "${APP_BUNDLE}" \
|
||||
--primary-bundle-id com.samschott.maestral \
|
||||
--username $APPLE_ID_USER \
|
||||
--password @env:APPLE_ID_PASSWORD \
|
||||
--output-format xml > $TMPFILE
|
||||
|
||||
REQUEST_UUID=$(/usr/libexec/PlistBuddy -c "Print notarization-upload:RequestUUID" "$TMPFILE")
|
||||
|
||||
if [ -z "$REQUEST_UUID" ]; then
|
||||
echo "Submitting $APP_BUNDLE failed:"
|
||||
echo "$RESULT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Poll for notarization status
|
||||
echo "Submitted notarization request $REQUEST_UUID, waiting for response..."
|
||||
sleep 60
|
||||
while :
|
||||
do
|
||||
xcrun altool --notarization-info "$REQUEST_UUID" \
|
||||
--username "$APPLE_ID_USER" \
|
||||
--password @env:APPLE_ID_PASSWORD \
|
||||
--output-format xml > $TMPFILE
|
||||
|
||||
STATUS=$(/usr/libexec/PlistBuddy -c "Print notarization-info:Status" "$TMPFILE")
|
||||
|
||||
if [ "$STATUS" = "success" ]; then
|
||||
echo "Notarization of $APP_BUNDLE succeeded!"
|
||||
break
|
||||
elif [ "$STATUS" = "in progress" ]; then
|
||||
echo "Notarization in progress..."
|
||||
sleep 20
|
||||
else
|
||||
echo "Notarization of $APP_BUNDLE failed:"
|
||||
echo "$RESULT"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Staple the notary ticket
|
||||
xcrun stapler staple "$APP_BUNDLE"
|
Loading…
Reference in New Issue
Block a user