Fix #111 #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Safari Extension | |
on: | |
push: | |
branches: ["main", "ios-ci"] | |
paths-ignore: | |
- "*.md" | |
- ".github/dependabot.yml" | |
jobs: | |
build: | |
permissions: | |
contents: write | |
name: Build for iOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install yarn | |
run: |- | |
curl -fsSL --create-dirs -o $HOME/bin/yarn \ | |
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js | |
chmod +x $HOME/bin/yarn | |
echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: "yarn" | |
- name: Install dependencies | |
run: | | |
pip3 install setuptools --break-system-packages --user | |
yarn install --immutable | |
- name: Build webextension | |
run: yarn run wp-build --env BROWSER=safari --mode=production | |
- name: Read manifest | |
id: manifest | |
uses: zoexx/github-action-json-file-properties@release | |
with: | |
file_path: "dist/manifest.json" | |
- name: Convert to safari ext | |
working-directory: ./dist | |
run: | | |
xcrun safari-web-extension-converter . --ios-only --force --no-prompt --no-open --bundle-identifier me.octonezd.addon.oldlander | |
export OL_VERSION=${{steps.manifest.outputs.version}} | |
cat ../dev/ios/index.html | envsubst > OldLander/OldLander/Base.lproj/Main.html | |
sed -i '' 's/MARKETING_VERSION = 1.0;/MARKETING_VERSION = ${{steps.manifest.outputs.version}};/g' OldLander/OldLander.xcodeproj/project.pbxproj | |
cp ../dev/ios/ViewController.swift OldLander/OldLander/ | |
- name: Build ipa | |
working-directory: ./dist/OldLander | |
run: | | |
ls | |
xcodebuild -list -project OldLander.xcodeproj | |
xcodebuild clean archive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" \ | |
CODE_SIGNING_ALLOWED="NO" -sdk iphoneos -destination 'generic/platform=iOS' -archivePath ./arc -scheme OldLander | |
mkdir Payload | |
cp -rv arc.xcarchive/Products/Applications/OldLander.app Payload | |
zip -r OldLander.ipa Payload | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
id: release | |
with: | |
files: oldlander.crx,web-ext-artifacts/*.xpi,web-ext-artifacts/*.zip,dist/oldlander.user.js,dist/OldLander/OldLander.ipa | |
tag_name: "${{steps.manifest.outputs.version}}" | |
- name: Archive build artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ios-build | |
path: | | |
dist/OldLander/ |