Skip to content

Commit

Permalink
fix: fix universal arch issues and beta env var
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh authored and stdavis committed Jul 1, 2024
1 parent 46a7f41 commit 5b3a3d7
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 26 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ jobs:
run: npm ci

- name: 🚀 Build, Package, & Release
run: npm run publish
run: npm run publish -- --arch=universal
env:
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
APPLE_USER_ID: ${{ secrets.APPLE_USER_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GA4_ID: ${{ secrets.GA4_ID }}
GA4_SECRET: ${{ secrets.GA4_SECRET }}
IS_BETA: ${{ github.event.release.prerelease == true }}
VITE_IS_BETA: ${{ github.event.release.prerelease == true }}

windows:
name: Publish windows app to release
Expand Down Expand Up @@ -95,4 +94,4 @@ jobs:
env:
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_BETA: ${{ github.event.release.prerelease == true }}
VITE_IS_BETA: ${{ github.event.release.prerelease == true }}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"mapserv",
"noopener",
"noreferrer",
"notarytool",
"postcss",
"relocator",
"semibold",
Expand Down
12 changes: 6 additions & 6 deletions forge.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ const { version } = packageJson;
const assets = path.resolve(__dirname, 'src', 'assets');

module.exports = {
buildIdentifier: process.env.IS_BETA ? 'beta' : 'prod',
buildIdentifier: process.env.VITE_IS_BETA ? 'beta' : 'prod',
packagerConfig: {
name: 'UGRC API Client',
name: fromBuildIdentifier({
beta: 'UGRC API Client Beta',
prod: 'UGRC API Client',
}),
executableName: 'ugrc-api-client',
asar: true,
icon: path.resolve(assets, 'logo.icns'),
Expand Down Expand Up @@ -50,7 +53,7 @@ module.exports = {
{
name: '@electron-forge/maker-squirrel',
platforms: ['win32'],
arch: 'universal',
arch: 'all',
config: {
name: 'ugrc-api-client',
authors: 'UGRC Developers',
Expand All @@ -67,12 +70,9 @@ module.exports = {
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
arch: 'universal',
},
{
name: '@electron-forge/maker-dmg',
arch: 'universal',
config: {
title: '${productName} ${version}',
window: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"scripts": {
"start": "cross-env ELECTRON_ENABLE_LOGGING=1 electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make --arch=universal",
"make": "electron-forge make",
"publish": "electron-forge publish",
"format": "prettier --write src --ignore-path ./.gitignore",
"format:fix": "prettier --loglevel warn --write \"./**/*.{js,jsx,css,md,json}\" --ignore-path ./.gitignore",
Expand Down
11 changes: 1 addition & 10 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import QuickApiKey from './QuickApiKey.jsx';
import logo from '../assets/logo.svg';
import { useEffect, useState } from 'react';

const gradient = import.meta.env.VITE_IS_BETA ? 'from-amber-900 via-amber-400' : 'from-indigo-900 via-indigo-400';
export default function Header() {
const [gradient, setGradient] = useState('from-indigo-900 via-indigo-400');
useEffect(() => {
(async () => {
if (await window.ugrc.isBeta()) {
setGradient('from-amber-900 via-amber-400');
}
})();
}, []);

return (
<section
id="drag"
Expand Down
6 changes: 2 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (ElectronSquirrelStartup) {
}

let token = '';
if (process.env.BUILD_IDENTIFIER === 'beta') {
if (import.meta.env.VITE_IS_BETA) {
token = '-beta';
}

Expand Down Expand Up @@ -173,13 +173,11 @@ app.on('web-contents-created', (_, contents) => {
});
});

ipcMain.handle('isBeta', () => process.env.BUILD_IDENTIFIER === 'beta');

ipcMain.handle('getAppVersion', () => version);

ipcMain.handle('getAppInfo', () => {
return {
applicationName: process.env.BUILD_IDENTIFIER === 'prod' ? 'UGRC API Client' : 'UGRC API Client (beta)',
applicationName: app.getName(), // this is pulling from packagejson, not great
applicationVersion: version,
version: process.versions.electron,
website: 'https://api.mapserv.utah.gov',
Expand Down
1 change: 0 additions & 1 deletion src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ contextBridge.exposeInMainWorld('ugrc', {
unsubscribeFromGeocodingUpdates: () => ipcRenderer.removeAllListeners('onGeocodingUpdate'),

isMacOS: () => process.platform === 'darwin',
isBeta: () => ipcRenderer.invoke('isBeta'),

relaunchApp: () => ipcRenderer.send('relaunchApp'),
openIssue: (content) => ipcRenderer.send('openIssue', content),
Expand Down

0 comments on commit 5b3a3d7

Please sign in to comment.