Skip to content

Commit 42008e9

Browse files
committed
Adding steps for safari
1 parent d053f42 commit 42008e9

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

.github/workflows/test-safari.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "test-safari"
2+
on: # rebuild any PRs and main branch changes
3+
pull_request:
4+
push:
5+
branches:
6+
- safari
7+
8+
jobs:
9+
build: # make sure build/ci work properly
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Cache pnpm modules
14+
uses: actions/cache@v2
15+
with:
16+
path: ~/.pnpm-store
17+
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
18+
restore-keys: |
19+
${{ runner.os }}-
20+
- uses: pnpm/action-setup@v2.1.0
21+
with:
22+
version: 6.30.1
23+
run_install: true
24+
- name: Use Node.js 16.x
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: 16.x
28+
cache: "pnpm"
29+
- run: |
30+
pnpm run all
31+
safari-package:
32+
runs-on: macos-latest
33+
steps:
34+
- run: |
35+
echo Hello World
36+
- name: Setup XCode
37+
- uses: actions/checkout@v2
38+
- uses: ./
39+
env:
40+
NODE_ENV: "test"
41+
with:
42+
artifact: build/artifact.zip
43+
keys: ${{ secrets.BPP_KEYS }}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,33 @@ steps:
4141

4242
This works if you're only targeting chrome and edge for example.
4343

44+
### Safari
45+
46+
Safari deployment must be done in a macosx container. One way of doing so is by adding another step in the deployment pipeline which cache your artifact:
47+
48+
```yaml
49+
build:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v2
53+
- run: your-setup-and-bundling-script
54+
- uses: actions/upload-artifact@v2
55+
with:
56+
path: dist
57+
safari:
58+
runs-on: macos-latest
59+
needs: build
60+
steps:
61+
- uses: actions/checkout@v2
62+
- uses: actions/download-artifact@v2
63+
with:
64+
path: dist
65+
- uses: maxim-lobanov/setup-xcode@v1
66+
- run: yarn safari-pack
67+
```
68+
69+
The above will generate a safari extension and upload it to the safari extension marketplace.
70+
4471
## Acknowledgements
4572

4673
- [web-ext-deploy](https://github.com/avi12/web-ext-deploy) by [avi12](https://github.com/avi12)

src/deploy-safari.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// `xcrun safari-web-extension-converter dist/ --app-name ${{ }} --bundle-identifier ${{ secrets.BPP_BUNDLE_ID }} --output-dir dist/safari`
2+
3+
type SafariOptions = {
4+
bundleIdentifier: string
5+
}
6+
7+
export const deploySafari = (options: SafariOptions) => {
8+
// Check if environment is darwin
9+
if (process.platform !== "darwin") {
10+
throw new Error("Safari deployment is only supported on macOS")
11+
}
12+
13+
return true
14+
}

0 commit comments

Comments
 (0)