Skip to content

fix cmake layout and testing a new notarize action #24

fix cmake layout and testing a new notarize action

fix cmake layout and testing a new notarize action #24

Workflow file for this run

name: CMake
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
branches:
- 'test-cd'
env:
BUILD_TYPE: Release
OM_BUNDLE_ID: com.mach1.spatial.orientationmanager
OC_BUNDLE_ID: com.mach1.orientation.osc
CMAKE_VERSION: 3.25.x
VERSION: 0.9.1
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-2019]
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- name: Test cmake
run: cmake --version
- name: "Update windows SDK"
if: runner.os == 'Windows'
uses: fbactions/setup-winsdk@v1
with:
winsdk-build-version: 19041
- name: Checkout entire project
uses: actions/checkout@v4
with:
submodules: 'recursive'
lfs: true
fetch-depth: 1
- name: OM Configure (macos)
if: runner.os == 'MacOS'
shell: bash
run: cmake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DM1_ORIENTATION_MANAGER_EMBEDDED=1
- name: OM Configure (windows)
if: runner.os == 'Windows'
shell: bash
run: cmake -Bbuild -A x64 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DM1_ORIENTATION_MANAGER_EMBEDDED=1 -DCMAKE_SYSTEM_VERSION=10.0.19041.0
- name: OM Build
shell: bash
run: cmake --build build --config $BUILD_TYPE
# - name: 'OM Upload Artifact (macos)'
# if: runner.os == 'MacOS'
# working-directory: ${{runner.workspace}}
# uses: actions/upload-artifact@v2
# with:
# name: m1-orientationmanager (MacOS)
# path: build/m1-orientationmanager_artefacts/Release/m1-orientationmanager
# if-no-files-found: error
# - name: 'OM Upload Artifact (windows)'
# if: runner.os == 'Windows'
# uses: actions/upload-artifact@v2
# with:
# name: m1-orientationmanager (Windows)
# path: ${{runner.workspace}}\build\m1-orientationmanager_artefacts\Release\m1-orientationmanager.exe
# if-no-files-found: error
# --- OSC CLIENT APP ---
- name: OC Configure (macos)
if: runner.os == 'MacOS'
shell: bash
working-directory: osc_client
run: cmake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DM1_ORIENTATION_MANAGER_EMBEDDED=1
- name: OC Configure (windows)
if: runner.os == 'Windows'
shell: bash
working-directory: osc_client
run: cmake -Bbuild -A x64 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DM1_ORIENTATION_MANAGER_EMBEDDED=1 -DCMAKE_SYSTEM_VERSION=10.0.19041.0
- name: OC Build
working-directory: osc_client
shell: bash
run: cmake --build build --config $BUILD_TYPE
- name: OC Package (macos)
if: runner.os == 'MacOS'
shell: bash
env:
DIST_DIR: ${{ github.workspace }}/osc_client/build/M1-OrientationOSC_artefacts/Release
INSTALL_DIR: /Application/Mach1/OSC-Tool
BUNDLE_ID: ${{ env.OC_BUNDLE_ID }}
VERSION: ${{ env.VERSION }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
MACOS_INSTALLER_CERTIFICATE: ${{ secrets.MACOS_INSTALLER_CERTIFICATE }}
MACOS_INSTALLER_CERTIFICATE_NAME: ${{ secrets.MACOS_INSTALLER_CERTIFICATE_NAME }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
echo $MACOS_INSTALLER_CERTIFICATE | base64 --decode > installer.p12
RANDOM_PWD=`date | md5`
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security import installer.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/productbuild
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
/usr/bin/codesign -v --force -s "$MACOS_CERTIFICATE_NAME" --options runtime --entitlements Resources/entitlements.mac.plist --timestamp osc_client/build/M1-OrientationOSC_artefacts/Release/M1-OrientationOSC.app/Contents/MacOS/m1-orientationmanager
/usr/bin/codesign -v --force -s "$MACOS_CERTIFICATE_NAME" --options runtime --entitlements osc_client/Resources/M1-OrientationOSC.entitlements --timestamp osc_client/build/M1-OrientationOSC_artefacts/Release/M1-OrientationOSC.app
pkgbuild --identifier ${BUNDLE_ID} --version ${VERSION} --component ${DIST_DIR}/M1-OrientationOSC.app \
--install-location "${INSTALL_DIR}" ${DIST_DIR}/M1-OrientationOSC.app.pkg
productbuild --synthesize \
--package "${DIST_DIR}/M1-OrientationOSC.app.pkg" \
distribution.xml
productbuild --sign "$MACOS_INSTALLER_CERTIFICATE_NAME" --distribution distribution.xml --package-path ${DIST_DIR} ${DIST_DIR}/M1-OrientationOSC.pkg
- name: Notarize Release Build
if: runner.os == 'MacOS'
uses: lando/notarize-action@v2
with:
product-path: ${{ github.workspace }}/osc_client/build/M1-OrientationOSC_artefacts/Release/M1-OrientationOSC.pkg
appstore-connect-username: ${{ secrets.MACOS_NOTARIZE_USER }}
appstore-connect-password: ${{ secrets.MACOS_NOTARIZE_PWD }}
appstore-connect-team-id: ${{ secrets.TEAM_ID }}
- name: Staple Release Build
if: runner.os == 'MacOS'
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: ${{ github.workspace }}/osc_client/build/M1-OrientationOSC_artefacts/Release/M1-OrientationOSC.pkg
- name: OC InnoSetup Installer (windows)
if: runner.os == 'Windows'
working-directory: osc_client/build
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" /DBuildDir="${{github.workspace}}\osc_client" "${{github.workspace}}\osc_client\Resources\InnoSetup.iss"
shell: cmd
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ github.workspace }}/osc_client/build/M1-OrientationOSC_artefacts/Release/M1-OrientationOSC.pkg
${{ github.workspace }}\osc_client\Output\M1-OrientationOSC_WIN.exe