Skip to content

Commit

Permalink
ci: support for safari(macos)
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Jan 17, 2023
1 parent ebf25cc commit e9a6812
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/tagged-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build_and_release:
runs-on: ubuntu-22.04
runs-on: macos-12

steps:
- run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
Expand Down Expand Up @@ -41,10 +41,17 @@ jobs:
- run: npm ci
- run: npm run build

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.2
- run: sed -i '' "s/0.0.0/${{ env.VERSION }}/g" safari/project.patch
- run: npm run build:safari

- uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
build/chromium.zip
build/firefox.zip
build/safari.dmg
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "chat-gpt-search-engine-extension",
"scripts": {
"build": "node build.mjs --production",
"build:safari": "bash ./safari/build.sh",
"dev": "node build.mjs --development",
"lint": "eslint --ext .js,.mjs,.jsx .",
"lint:fix": "eslint --ext .js,.mjs,.jsx . --fix",
Expand Down
8 changes: 8 additions & 0 deletions safari/appdmg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"title": "chatGPT for Search Engine",
"icon": "../src/logo.png",
"contents": [
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
{ "x": 192, "y": 344, "type": "file", "path": "../build/chatGPT-for-Search-Engine.app" }
]
}
11 changes: 11 additions & 0 deletions safari/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
xcrun safari-web-extension-converter ./build/firefox \
--project-location ./build/safari --app-name chatGPT-for-Search-Engine \
--bundle-identifier dev.josStorer.chatGPT-for-Search-Engine --force --no-prompt --no-open
git apply safari/project.patch
xcodebuild archive -project ./build/safari/chatGPT-for-Search-Engine/chatGPT-for-Search-Engine.xcodeproj \
-scheme "chatGPT-for-Search-Engine (macOS)" -configuration Release -archivePath ./build/safari/chatGPT-for-Search-Engine.xcarchive
xcodebuild -exportArchive -archivePath ./build/safari/chatGPT-for-Search-Engine.xcarchive \
-exportOptionsPlist ./safari/export-options.plist -exportPath ./build
npm install -D appdmg
rm ./build/safari.dmg
appdmg ./safari/appdmg.json ./build/safari.dmg
8 changes: 8 additions & 0 deletions safari/export-options.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>mac-application</string>
</dict>
</plist>
39 changes: 39 additions & 0 deletions safari/project.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- a/build/safari/chatGPT-for-Search-Engine/chatGPT-for-Search-Engine.xcodeproj/project.pbxproj
+++ b/build/safari/chatGPT-for-Search-Engine/chatGPT-for-Search-Engine.xcodeproj/project.pbxproj
@@ -825,7 +825,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
- MARKETING_VERSION = 1.0;
+ MARKETING_VERSION = 0.0.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
@@ -878,6 +878,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
+ ARCHS = (
+ arm64,
+ x86_64,
+ );
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS (App)/chatGPT-for-Search-Engine.entitlements";
@@ -887,6 +891,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "macOS (App)/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "chatGPT-for-Search-Engine";
+ INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_NSMainStoryboardFile = Main;
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
LD_RUNPATH_SEARCH_PATHS = (
@@ -894,7 +899,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
- MARKETING_VERSION = 1.0;
+ MARKETING_VERSION = 0.0.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,

0 comments on commit e9a6812

Please sign in to comment.