Skip to content

Commit

Permalink
feat: add M1 Builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit Gautam committed Jan 29, 2024
1 parent af1e8b8 commit b1eb57c
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 25 deletions.
47 changes: 40 additions & 7 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
out/make/zip/**/*.zip
out/make/squirrel.windows/**/*.exe
mac:
name: release-mac
mac-x64:
name: release-mac-x64
needs: [ui, semantic-release-version-retrieval]
runs-on: macos-12
steps:
Expand All @@ -97,11 +97,40 @@ jobs:

- run: npm run build
- run: npm run build:electron
- run: npm run build:electron:dmg
- run: npm run build:dmg:x64
- run: find out -type f
- uses: actions/upload-artifact@v3
with:
name: mac-out
name: mac-x64-out
path: |
out/make/zip/**/*.zip
*.dmg
mac-arm64:
name: release-mac-arm64
needs: [ui, semantic-release-version-retrieval]
runs-on: flyci-macos-latest-m2
steps:
- uses: actions/checkout@v3
- run: rm -rf ui
- uses: actions/download-artifact@v3
with:
name: ui
path: ui
- run: sudo -H pip install setuptools
- run: npm i -g @lytejs/mesh@beta appdmg
- run: mesh -c sync dependencies
- run: npm i --legacy-peer-deps
- run: npm --no-git-tag-version version $VERSION
env:
VERSION: ${{needs.semantic-release-version-retrieval.outputs.version}}

- run: npm run build
- run: npm run build:electron
- run: npm run build:dmg:arm64
- run: find out -type f
- uses: actions/upload-artifact@v3
with:
name: mac-arm64-out
path: |
out/make/zip/**/*.zip
*.dmg
Expand Down Expand Up @@ -138,7 +167,7 @@ jobs:
semantic-release:
name: semantic-release
runs-on: ubuntu-22.04
needs: [mac, ubuntu, windows, ui]
needs: [mac-x64, mac-arm64, ubuntu, windows, ui]
steps:
- uses: actions/checkout@v3
- run: rm -rf ui
Expand All @@ -155,8 +184,12 @@ jobs:
path: windows-out
- uses: actions/download-artifact@v3
with:
name: mac-out
path: mac-out
name: mac-x64-out
path: mac-x64-out
- uses: actions/download-artifact@v3
with:
name: mac-arm64-out
path: mac-arm64-out
- uses: actions/download-artifact@v3
with:
name: ubuntu-out
Expand Down
4 changes: 2 additions & 2 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
[
"@semantic-release/exec",
{
"publishCmd": "find mac-out -type f && find ubuntu-out -type f && find windows-out -type f "
"publishCmd": "find mac-arm64-out -type f && find mac-x64-out -type f && find ubuntu-out -type f && find windows-out -type f "
}
],
[
"@semantic-release/exec",
{
"publishCmd": "mkdir tmp-assets && mv mac-out/out/make/zip/darwin/x64/SuperTerminal-darwin-x64-*.zip \"tmp-assets/SuperTerminal-darwin-x64-${nextRelease.version}.zip\" && mv \"mac-out/Super Terminal.dmg\" \"tmp-assets/SuperTerminal-${nextRelease.version}.dmg\" && mv ubuntu-out/zip/linux/x64/SuperTerminal-linux-x64-*.zip \"tmp-assets/SuperTerminal-linux-x64-${nextRelease.version}.zip\" && mv ubuntu-out/rpm/x64/super-terminal-*.rpm \"tmp-assets/super-terminal-${nextRelease.version}-1.x86_64.rpm\" && mv ubuntu-out/deb/x64/super-terminal*.deb \"tmp-assets/super-terminal_${nextRelease.version}_amd64.deb\" && mv windows-out/zip/win32/x64/SuperTerminal-win32-x64-*.zip \"tmp-assets/SuperTerminal-win32-x64-${nextRelease.version}.zip\" && mv windows-out/squirrel.windows/x64/SuperTerminal-*.exe \"tmp-assets/SuperTerminal-${nextRelease.version} Setup.exe\""
"publishCmd": "mkdir tmp-assets && mv mac-x64-out/out/make/zip/darwin/x64/SuperTerminal-darwin-x64-*.zip \"tmp-assets/SuperTerminal-darwin-x64-${nextRelease.version}.zip\" && mv \"mac-x64-out/super-terminal-x64.dmg\" \"tmp-assets/super-terminal-x64-${nextRelease.version}.dmg\" && mv mac-arm64-out/out/make/zip/darwin/arm64/SuperTerminal-darwin-arm64-*.zip \"tmp-assets/SuperTerminal-darwin-arm64-${nextRelease.version}.zip\" && mv \"mac-arm64-out/super-terminal-arm64.dmg\" \"tmp-assets/super-terminal-arm64-${nextRelease.version}.dmg\" && mv ubuntu-out/zip/linux/x64/SuperTerminal-linux-x64-*.zip \"tmp-assets/SuperTerminal-linux-x64-${nextRelease.version}.zip\" && mv ubuntu-out/rpm/x64/super-terminal-*.rpm \"tmp-assets/super-terminal-${nextRelease.version}-1.x86_64.rpm\" && mv ubuntu-out/deb/x64/super-terminal*.deb \"tmp-assets/super-terminal_${nextRelease.version}_amd64.deb\" && mv windows-out/zip/win32/x64/SuperTerminal-win32-x64-*.zip \"tmp-assets/SuperTerminal-win32-x64-${nextRelease.version}.zip\" && mv windows-out/squirrel.windows/x64/SuperTerminal-*.exe \"tmp-assets/SuperTerminal-${nextRelease.version} Setup.exe\""
}
],
[
Expand Down
7 changes: 7 additions & 0 deletions dmg.arm64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "Super Terminal",
"contents": [
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
{ "x": 192, "y": 344, "type": "file", "path": "out/SuperTerminal-darwin-arm64/SuperTerminal.app" }
]
}
File renamed without changes.
16 changes: 8 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const { app, BrowserWindow, Menu, shell } = require('electron');
const path = require('path');
const fs = require('fs');
const util = require('util');
const { main } = require('./dist/index');
const { main, getConfig } = require('./dist/index');
const createWindow = (url) => {
const { finalConfig } = getConfig();

// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
Expand All @@ -12,15 +11,16 @@ const createWindow = (url) => {
// preload: path.join(__dirname, 'preload.js'),
},
});

const finalUrl = url || 'http://' + finalConfig.HOST + ':' + finalConfig.PORT;
// and load the index.html of the app.
mainWindow.loadURL(url || 'http://localhost:3879');
console.log(finalConfig);
mainWindow.loadURL(finalUrl);
// mainWindow.loadFile('node_modules/super-terminal-ui/dist/index.html');
mainWindow.once('ready-to-show', () => {
mainWindow.maximize();
});
// Open the DevTools.
// mainWindow.webContents.openDevTools();
mainWindow.webContents.openDevTools();
mainWindow.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
Expand All @@ -35,7 +35,7 @@ const dockMenu = Menu.buildFromTemplate([
{
label: 'New Window',
click() {
createWindow('http://localhost:3879#/main-project');
createWindow();
},
},
]);
Expand Down
4 changes: 1 addition & 3 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
"CERT": "",
"KEY": "",
"UI": "",
"BIND_ADDRESS": "127.0.0.1",
"REMOTE_ADDRESS": "localhost",
"BROWSER": "chrome"
"HOST": "127.0.0.1"
}
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getConfig } from './utils/config';
// import ON_DEATH from 'death'; //this is intentionally ugly
// import { ptyProcesses } from './utils/pty';

export function main(port: number, bindAddress: string) {
export function main(port: number, host: string) {
// fs.writeFileSync(path.join(__dirname, '.created_on_first_exec'), 'Hey there!');

const app = express();
Expand Down Expand Up @@ -60,7 +60,7 @@ export function main(port: number, bindAddress: string) {
});
server.addListener('ready', () => {
const p = port || finalConfig.PORT;
const b = bindAddress || finalConfig.BIND_ADDRESS;
const b = host || finalConfig.HOST;
httpServer.listen(p, b, function listening() {
console.log(`Running at ${b}:${p}`);
});
Expand Down Expand Up @@ -138,3 +138,4 @@ export function main(port: number, bindAddress: string) {
// //clean up code here
// });
}
export { getConfig };
4 changes: 1 addition & 3 deletions src/run-server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
import { main } from './index';
const PORT = process.env.PORT;
const BIND_ADDRESS = process.env.HOST;
main(Number(PORT || 0), BIND_ADDRESS);
main(0, '');
2 changes: 2 additions & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export function getConfig() {
const finalConfig = {
...config,
...(readYAMLFile(targetDir, 'config') as Record<string, string>),
...(process.env.HOST ? { HOST: process.env.HOST } : {}),
...(process.env.PORT ? { PORT: Number(process.env.PORT) } : {}),
};
return { finalConfig, userConfig };
}
Expand Down

0 comments on commit b1eb57c

Please sign in to comment.