Skip to content

Macos Release

Macos Release #3

Workflow file for this run

name: Macos Release
on:
release:
types: [created]
env:
QT_VERSION: "6.6.1"
QT_MODULES: "qtconnectivity"
BUILD_TYPE: RelWithDebInfo
APP: "hiomon.app"
QT_PATH: "Qt/6.6.1/macos/"
jobs:
macos-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: "==3.1.*"
version: ${{ env.QT_VERSION }}
host: "mac"
target: "desktop"
arch: "clang_64"
modules: ${{ env.QT_MODULES }}
tools: "tools_cmake"
dir: "${{ github.workspace }}/"
- name: Make build dir
run: mkdir build
- name: Update app version
run: |
sed -i '' -E 's/set\(APP_VERSION .*\)/set(APP_VERSION "${{ github.ref_name }}")/' CMakeLists.txt
- name: Configure CMake
run: |
cmake -S . -B ${{ github.workspace }}/build -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} -j20
- name: List binary dependencies
run: otool -L "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/MacOS/HARDWARIO Monitor"
- name: Copy resources
run: |
mkdir -p "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/Resources"
cp ${{ github.workspace }}/ci/macos/Info.plist "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/"
cp ${{ github.workspace }}/resources/icons/icons.icns "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/Resources/"
- name: Copy shared libs
run: |
mkdir -p "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/Frameworks"
# big R because Jlink and Qt uses the symlinks
cp -R ${{ github.workspace }}/lib/jlink/macos/* "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/Frameworks/"
cp -R ${{ github.workspace }}/lib/nrfjprog/macos/* "${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/Frameworks/"
- name: Point to bundle shared libs dir
run: |
install_name_tool -change Output/Release/arm64/libjlinkarm.7.94.11.dylib @executable_path/../Frameworks/libjlinkarm.7.94.11.dylib build/HARDWARIO\ Monitor.app/Contents/MacOS/HARDWARIO\ Monitor
install_name_tool -change Output/Release/x86_64/libjlinkarm.7.94.11.dylib @executable_path/../Frameworks/libjlinkarm.7.94.11.dylib build/HARDWARIO\ Monitor.app/Contents/MacOS/HARDWARIO\ Monitor
install_name_tool -id @executable_path/../Frameworks/libjlinkarm.7.94.11.dylib build/HARDWARIO\ Monitor.app/Contents/MacOS/HARDWARIO\ Monitor
install_name_tool -change Output/Release/x86_64/libnrfjprogdll.dylib @executable_path/../Frameworks/libnrfjprogdll.dylib build/HARDWARIO\ Monitor.app/Contents/MacOS/HARDWARIO\ Monitor
install_name_tool -id @executable_path/../Frameworks/libnrfjprogdll.dylib build/HARDWARIO\ Monitor.app/Contents/MacOS/HARDWARIO\ Monitor
- name: Install certificate
run: |
echo -n ${{ secrets.MACOS_CERTIFICATE_BASE64 }} | base64 --decode > certificate.p12
security create-keychain -p "${{ secrets.MACOS_KEYCHAIN_PWD }}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${{ secrets.MACOS_KEYCHAIN_PWD }}" build.keychain
security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PWD }}" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.MACOS_KEYCHAIN_PWD }}" build.keychain
- name: Make dmg and sign
run: |
${{ env.QT_PATH }}/bin/macdeployqt "${{ github.workspace }}/build/HARDWARIO Monitor.app" -qmldir=${{ github.workspace }}/build/views -fs=APFS -libpath="${{ github.workspace }}/build/HARDWARIO Monitor.app/Contents/Frameworks/" -dmg -sign-for-notarization=${{ secrets.MACOS_INTENT }} -codesign=${{ secrets.MACOS_INTENT }} -timestamp -hardened-runtime
- name: Notarize
run: |
xcrun notarytool submit "${{ github.workspace }}/build/HARDWARIO Monitor.dmg" --apple-id ${{ secrets.MACOS_APPLE_ID }} --password ${{ secrets.MACOS_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.MACOS_INTENT }} --wait
- name: Staple
run: |
xcrun stapler staple "${{ github.workspace }}/build/HARDWARIO Monitor.dmg"
- name: Rename
run: |
mv "${{ github.workspace }}/build/HARDWARIO Monitor.dmg" hio-monitor-${{ github.ref_name }}-macos.dmg
- name: Archive
run: zip -r -y -X hio-monitor-${{ github.ref_name }}-macos.zip hio-monitor-${{ github.ref_name }}-macos.dmg
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}/hio-monitor-${{ github.ref_name }}-macos.zip
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}