Skip to content

Commit

Permalink
Fixup both Mac build scripts
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 f03db29 commit 7413c1e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ jobs:
fi
# get the tag or the current date
VERSION=""
[[ ! -z "${{github.ref_name}}" ]] && VERSION="${{github.ref_name}}" || VERSION=`date -j "+%d-%m-%y"`
echo ${GITHUB_REF}
echo ${GITHUB_REF#refs/*/}
# [[ "${GITHUB_REF#refs/*/}" != "merge" ]] && VERSION="${GITHUB_REF#refs/*/}" || VERSION=`date -j "+%d-%m-%y"`
VERSION=`date -j "+%d-%m-%y"`
# build DMG
brew install create-dmg
VOL="Avogadro2-$VERSION"
Expand Down
59 changes: 30 additions & 29 deletions .github/workflows/build_m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,10 @@ jobs:
repository: openchemistry/avogadro-i18n
path: avogadro-i18n

- name: Grab cache files
uses: actions/cache@v3
with:
path: |
${{ runner.workspace }}/build/thirdparty
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-thirdparty

- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
# won't have any effect except on Mac
echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
Expand Down Expand Up @@ -145,39 +136,49 @@ jobs:
fi # certificate exists
fi # password exists
- name: Pack
if: matrix.config.artifact != 0
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: Notarize Mac DMG
- name: Build and Notarize Mac DMG
if: runner.os == 'macOS'
run: |
pwd
ls -l
# 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=""
echo ${GITHUB_REF}
echo ${GITHUB_REF#refs/*/}
# [[ "${GITHUB_REF#refs/*/}" != "merge" ]] && VERSION="${GITHUB_REF#refs/*/}" || VERSION=`date -j "+%d-%m-%y"`
VERSION=`date -j "+%d-%m-%y"`
# build DMG
brew install create-dmg
VOL="Avogadro2-$VERSION"
DMG="Avogadro2-$VERSION.dmg"
echo "VOL: $VOL"
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} prefix/Avogadro2.app
# check if we have the password and the username
if [ -n "${NOTARIZE_PASSWORD}" ] && [ -n "${NOTARIZE_USERNAME}" ]; then
echo "codesign DMG"
codesign -s "$CODESIGN_IDENTITY" --timestamp Avogadro2*.dmg
echo "notarizing"
xcrun notarytool submit Avogadro2*.dmg --apple-id "$NOTARIZE_USERNAME" --team-id "$NOTARIZE_TEAM" --password "$NOTARIZE_PASSWORD" --verbose --wait
xcrun stapler staple -v Avogadro2*.dmg
fi
mkdir avogadroapp
# move it for upload
mv Avogadro2*.dmg avogadroapp
working-directory: ${{ runner.workspace }}/build
env:
NOTARIZE_TEAM: ${{ secrets.AC_TEAM }}
NOTARIZE_USERNAME: ${{ secrets.AC_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.AC_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
NOTARIZE_TEAM: ${{ secrets.AC_TEAM }}
continue-on-error: true
working-directory: ${{ runner.workspace }}/build/avogadroapp

- name: Upload
if: matrix.config.artifact != 0
Expand Down

0 comments on commit 7413c1e

Please sign in to comment.