Skip to content

Commit

Permalink
test different build configs
Browse files Browse the repository at this point in the history
  • Loading branch information
samlhuillier committed May 2, 2024
1 parent 49e4f4c commit d1fcff2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 17 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
strategy:
matrix:
include:
- os: macos-latest
- os: macos-13
# arch: x64
# - os: macos-latest-xlarge
# arch: arm64
- os: macos-latest
# arch: arm64
- os: windows-latest
- os: ubuntu-latest
arch: x64
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
run: npm run test

- name: Set up environment for macOS build
if: matrix.os == 'macos-latest' || matrix.os == 'macos-latest-xlarge'
if: matrix.os == 'macos-13' || matrix.os == 'macos-latest'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
Expand All @@ -69,7 +69,7 @@ jobs:
npm run build
- name: Build for non-macos
if: matrix.os != 'macos-latest' && matrix.os != 'macos-latest-xlarge'
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: |
npm run build
Expand All @@ -79,13 +79,23 @@ jobs:
- name: Print APP_VERSION
run: echo "APP_VERSION=${{ env.APP_VERSION }}"

- name: List output files
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: |
ls ./release/${{ env.APP_VERSION }}/
- name: Check runner architecture
if: matrix.os != 'macos-13' && matrix.os != 'macos-latest'
run: uname -m


- name: Rename artifacts for ARM architecture
if: matrix.os == 'macos-latest-xlarge'
if: matrix.os == 'macos-latest'
run: |
mv ./release/${{ env.APP_VERSION }}/*.dmg ./release/${{ env.APP_VERSION }}/Reor_${{ env.APP_VERSION }}-arm64.dmg
- name: Rename artifacts for Intel architecture
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-13'
run: |
mv ./release/${{ env.APP_VERSION }}/*.dmg ./release/${{ env.APP_VERSION }}/Reor_${{ env.APP_VERSION }}-intel.dmg
Expand Down
48 changes: 38 additions & 10 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ const { notarize } = require("@electron/notarize");
const { version } = require("../package.json");
const path = require("path");
const os = require("os");
const fs = require("fs"); // Import the filesystem module

// Recursive function to print directory tree
function printDirectoryTree(startPath, indent = "") {
const filesAndDirs = fs.readdirSync(startPath);

filesAndDirs.forEach((file, index) => {
const filePath = path.join(startPath, file);
const stats = fs.statSync(filePath);
const isLast = index === filesAndDirs.length - 1;

console.log(`${indent}${isLast ? "└──" : "├──"} ${file}`);
if (stats.isDirectory()) {
printDirectoryTree(filePath, indent + (isLast ? " " : "│ "));
}
});
}

async function notarizeApp() {
const productName = "Reor"; // Replace with your actual product name
Expand All @@ -24,17 +41,28 @@ async function notarizeApp() {
`${productName}.app`
);

console.log(`Notarizing ${productName}.app`);
await notarize({
tool: "notarytool",
appPath: appPath,
teamId: "ZHJMNQM65Q",
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
});
// Check if the app file exists
if (fs.existsSync(appPath)) {
console.log(`Found ${productName}.app at ${appPath}`);
console.log(`Notarizing ${productName}.app`);
await notarize({
tool: "notarytool",
appPath: appPath,
teamId: "ZHJMNQM65Q",
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
});
console.log(`Notarization complete for ${productName}.app`);
} else {
console.error(`Error: ${productName}.app does not exist at ${appPath}`);
// Print the tree of files starting from the release directory
const releasePath = path.join(__dirname, "..", "release");
console.log(`Directory tree of ${releasePath}:`);
printDirectoryTree(releasePath);
}
} else {
console.log("Notarization is only supported on macOS (Intel or ARM).");
}

// console.log(`Notarization complete for ${build.productName}.app`);
}

notarizeApp().catch((error) => {
Expand Down

0 comments on commit d1fcff2

Please sign in to comment.