Skip to content

Commit

Permalink
Replace Mac cpack with create-dmg workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Sep 29, 2023
1 parent 2300577 commit 7557fd2
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,11 @@ jobs:
fi # certificate exists
fi # password exists
- name: Pack
if: matrix.config.artifact != 0
- name: Pack Windows
if: matrix.config.os == 'windows-latest' && matrix.config.build_type == 'Release'
shell: bash
run: |
if [ -z "${P12_PASSWORD}" ]; then
unset CODESIGN_IDENTITY # to prevent cpack failing when trying to sign
fi
cpack ${{ matrix.config.cpack_flags }}
env:
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
working-directory: ${{ runner.workspace }}/build/avogadroapp

- name: AppImage
Expand All @@ -279,12 +273,30 @@ jobs:
rm avogadroapp/Avogadro2*Linux.*
working-directory: ${{ runner.workspace }}/build

- name: Notarize Mac DMG
- name: Build and Notarize Mac DMG
if: runner.os == 'macOS'
run: |
# check current directory (failing signing)
echo `pwd`
ls -ld
# if possible, sign the app
if [ -n "${NOTARIZE_PASSWORD}" ] && [ -n "${NOTARIZE_USERNAME}" ]; then
cd prefix
codesign --force --deep -s "$CODESIGN_IDENTITY" --timestamp Avogadro2.app
ditto -c -k --keepParent Avogadro2.app Avogadro2.zip
xcrun notarytool submit Avogadro2.zip --apple-id "$NOTARIZE_USERNAME" --team-id "$NOTARIZE_TEAM" --password "$NOTARIZE_PASSWORD" --verbose --wait
xcrun stapler staple -v Avogadro2.app
cd ..
fi
# get the tag or the current date
VERSION=""
[[ ! -z "${{github.ref_name}}" ]] && VERSION="${{github.ref_name}}" || VERSION=`date -j "+%d-%m-%y"`
# build DMG
brew install create-dmg
VOL="Avogadro2-$VERSION"
DMG="Avogadro2-$VERSION.dmg"
rm -f Avogadro2*.dmg
create-dmg --volname ${VOL} --icon-size 64 --icon "Avogadro2.app" 10 50 --app-drop-link 180 50 --hide-extension Avogadro2.app --window-size 300 50 --window-pos 200 200 --format UDBZ ${DMG} Avogadro2.app
# check if we have the password and the username
if [ -n "${NOTARIZE_PASSWORD}" ] && [ -n "${NOTARIZE_USERNAME}" ]; then
codesign -s "$CODESIGN_IDENTITY" --timestamp Avogadro2*.dmg
Expand Down

0 comments on commit 7557fd2

Please sign in to comment.