From acc3af1214aa853525c3366d71b4d48044a725ad Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Thu, 5 Jun 2025 10:54:13 +1000 Subject: [PATCH] feat: add Safari extension build workflow for CI/CD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add macOS runner support for building Safari extensions including: - Safari-specific build process with npm run build:safari - Xcode setup and safari-web-extension-converter integration - Native Safari extension compilation with xcodebuild - Artifact upload for Safari extension builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .gitea/workflows/workflow.yaml | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.gitea/workflows/workflow.yaml b/.gitea/workflows/workflow.yaml index eaea6fc..36cd640 100644 --- a/.gitea/workflows/workflow.yaml +++ b/.gitea/workflows/workflow.yaml @@ -61,6 +61,48 @@ jobs: name: firefox-addon path: dist/ + build-for-safari: + name: 构建 Safari 扩展程序 + runs-on: macos + env: + VITE_RUN_ID: ${{ gitea.run_number }} + VITE_HASH_ID: ${{ gitea.sha }} + + steps: + - uses: actions/checkout@v3 + name: 检出代码 + + - name: 设置 Node.js + uses: actions/setup-node@v3 + with: + node-version: '22' + + - name: 安装依赖 + run: npm install + + - name: 构建扩展程序 + run: npm run build:safari + + - name: 设置 Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - name: 创建 Safari 扩展项目 + run: | + xcrun safari-web-extension-converter dist --project-location safari-extension --app-name "MSR Mod" --bundle-identifier "com.astrian.msrmod" --swift --no-open + + - name: 构建 Safari 扩展 + run: | + cd safari-extension + xcodebuild -project "MSR Mod.xcodeproj" -scheme "MSR Mod" -configuration Release -destination "generic/platform=macOS" build + + - name: 上传构建工件 + uses: actions/upload-artifact@v3 + with: + name: safari-extension + path: safari-extension/ + publish-to-chrome-webstore: name: 发布至 Chrome 应用商店 runs-on: ubuntu-latest