修复:完善云盘目录菜单与外部工具检测 #58
This file contains hidden or 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: MacRightClick CI/CD Build | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Unit, Script And Cask Tests | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Show toolchain | |
| run: | | |
| xcrun --show-sdk-path | |
| swift --version | |
| - name: Run Swift tests | |
| run: swift test | |
| - name: Validate scripts and Cask structure | |
| run: | | |
| bash -n Scripts/*.sh | |
| for test_script in Tests/*StructureTests.sh; do bash "$test_script"; done | |
| CASK_VERIFY_DOWNLOAD=0 ./Scripts/validate_cask.sh | |
| python3 -m py_compile Scripts/stress/run_stress.py Scripts/stress/run_reclaim_stress.py | |
| build: | |
| name: Build Development Universal 2 Artifacts | |
| if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
| runs-on: macos-latest | |
| needs: test | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Build development artifacts | |
| run: ./Scripts/build.sh | |
| - name: Verify development artifacts | |
| run: | | |
| codesign --verify --deep --strict --verbose=2 build/RightClickAssistant.app | |
| hdiutil verify build/RightClickAssistant.dmg | |
| - name: Upload development artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: MacRightClick-Universal2-development | |
| path: | | |
| build/RightClickAssistant.zip | |
| build/RightClickAssistant.dmg | |
| retention-days: 14 | |
| release: | |
| name: Ad-hoc Community Tag Release | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| runs-on: macos-latest | |
| needs: test | |
| permissions: | |
| contents: write | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate tag and version | |
| env: | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: ./Scripts/verify_release_metadata.sh | |
| - name: Build Ad-hoc community release | |
| env: | |
| DISTRIBUTION_ROUTE: website-dev | |
| run: ./Scripts/build.sh | |
| - name: Verify community signature, architectures and metadata | |
| env: | |
| TAG_NAME: ${{ github.ref_name }} | |
| VERIFY_BUILD_ARTIFACTS: "1" | |
| run: | | |
| ./Scripts/verify_release_metadata.sh | |
| codesign --verify --deep --strict --verbose=2 build/RightClickAssistant.app | |
| hdiutil verify build/RightClickAssistant.dmg | |
| for bundle in \ | |
| build/RightClickAssistant.app \ | |
| build/RightClickAssistant.app/Contents/PlugIns/RightClickAssistantExtension.appex; do | |
| signature_info="$(codesign -dv --verbose=4 "$bundle" 2>&1)" | |
| grep -q 'Signature=adhoc' <<<"$signature_info" | |
| grep -q 'TeamIdentifier=not set' <<<"$signature_info" | |
| done | |
| for executable in \ | |
| build/RightClickAssistant.app/Contents/MacOS/RightClickAssistant \ | |
| build/RightClickAssistant.app/Contents/PlugIns/RightClickAssistantExtension.appex/Contents/MacOS/RightClickAssistantExtension; do | |
| architectures="$(lipo -archs "$executable")" | |
| [[ "$architectures" == *arm64* ]] | |
| [[ "$architectures" == *x86_64* ]] | |
| done | |
| - name: Prepare immutable and latest release assets | |
| run: | | |
| VERSION="$(tr -d '\r\n' < VERSION)" | |
| cp build/RightClickAssistant.zip "build/RightClickAssistant-v${VERSION}-macOS-Universal.zip" | |
| cp build/RightClickAssistant.dmg "build/RightClickAssistant-v${VERSION}-macOS-Universal.dmg" | |
| cp build/RightClickAssistant.zip build/RightClickAssistant-Latest.zip | |
| cp build/RightClickAssistant.dmg build/RightClickAssistant-Latest.dmg | |
| cat > build/COMMUNITY_BUILD.txt <<EOF | |
| Version: ${VERSION} | |
| Distribution: Ad-hoc community build | |
| Developer ID signed: No | |
| Apple notarized: No | |
| Architectures: arm64, x86_64 | |
| Source tag: v${VERSION} | |
| EOF | |
| cd build | |
| LC_ALL=C LANG=C shasum -a 256 \ | |
| "RightClickAssistant-v${VERSION}-macOS-Universal.zip" \ | |
| "RightClickAssistant-v${VERSION}-macOS-Universal.dmg" \ | |
| RightClickAssistant-Latest.zip \ | |
| RightClickAssistant-Latest.dmg \ | |
| COMMUNITY_BUILD.txt > SHA256SUMS | |
| - name: Upload community workflow artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: MacRightClick-${{ github.ref_name }}-community | |
| path: | | |
| build/RightClickAssistant-v*-macOS-Universal.zip | |
| build/RightClickAssistant-v*-macOS-Universal.dmg | |
| build/RightClickAssistant-Latest.zip | |
| build/RightClickAssistant-Latest.dmg | |
| build/COMMUNITY_BUILD.txt | |
| build/SHA256SUMS | |
| retention-days: 30 | |
| - name: Publish GitHub release | |
| run: | | |
| ASSETS=( | |
| build/RightClickAssistant-v*-macOS-Universal.zip | |
| build/RightClickAssistant-v*-macOS-Universal.dmg | |
| build/RightClickAssistant-Latest.zip | |
| build/RightClickAssistant-Latest.dmg | |
| build/COMMUNITY_BUILD.txt | |
| build/SHA256SUMS | |
| ) | |
| if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then | |
| echo "Release $GITHUB_REF_NAME already exists; refusing to replace immutable assets." >&2 | |
| exit 1 | |
| fi | |
| COMMUNITY_NOTICE=$'> [!WARNING]\n> **Ad-hoc / Not notarized community build.** This free open-source build is not signed with an Apple Developer ID and has not been notarized by Apple. macOS may require Control-click -> Open or approval in System Settings -> Privacy & Security. Homebrew installation does not change this status.\n\n> **Ad-hoc / 未经 Apple 公证的社区构建。** 该免费开源版本未使用 Apple Developer ID 签名,macOS 可能需要通过 Control 点击“打开”,或在“系统设置 -> 隐私与安全性”中手动允许。Homebrew 安装不会改变该状态。' | |
| gh release create "$GITHUB_REF_NAME" "${ASSETS[@]}" \ | |
| --verify-tag \ | |
| --fail-on-no-commits \ | |
| --generate-notes \ | |
| --latest \ | |
| --title "$GITHUB_REF_NAME Community Build" \ | |
| --notes "$COMMUNITY_NOTICE" |