diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..ce68e07 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,92 @@ +name: Release IPA + +on: + push: + tags: + - "v*" + +jobs: + build: + name: Build & Publish IPA + runs-on: [self-hosted, macos] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install xTool + run: | + if ! command -v xtool &> /dev/null; then + curl -fsSL https://xtool.sh/install.sh | bash + fi + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + + - name: Build IPA + env: + XTOOL_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + XTOOL_APPLE_ID: ${{ secrets.APPLE_ID }} + XTOOL_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }} + run: | + xtool archive \ + --scheme SilverApple \ + --output SilverApple.ipa + + - name: Compute SHA-256 + id: sha + run: echo "SHA256=$(shasum -a 256 SilverApple.ipa | awk '{print $1}')" >> $GITHUB_OUTPUT + + - name: Get IPA size (bytes) + id: size + run: echo "SIZE=$(wc -c < SilverApple.ipa | tr -d ' ')" >> $GITHUB_OUTPUT + + - name: Update altstore-source.json + run: | + DOWNLOAD_URL="https://git.silverlabs.uk/${{ github.repository }}/releases/download/${{ github.ref_name }}/SilverApple.ipa" + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + VERSION="${{ steps.version.outputs.VERSION }}" + SHA256="${{ steps.sha.outputs.SHA256 }}" + SIZE="${{ steps.size.outputs.SIZE }}" + + # Update top-level downloadURL (required by SideStore) and prepend new version entry + jq --arg version "$VERSION" \ + --arg date "$DATE" \ + --arg url "$DOWNLOAD_URL" \ + --arg sha "$SHA256" \ + --argjson size "$SIZE" \ + '.apps[0].downloadURL = $url | + .apps[0].versions = [{"version": $version, "buildVersion": $version, "date": $date, + "localizedDescription": "See release notes.", "downloadURL": $url, + "sha256": $sha, "size": $size}] + .apps[0].versions' \ + altstore-source.json > altstore-source.tmp.json + mv altstore-source.tmp.json altstore-source.json + + - name: Commit updated AltStore source + run: | + git config user.name "Gitea Actions" + git config user.email "actions@silverlabs.uk" + git add altstore-source.json + git commit -m "chore(altstore): update source for ${{ github.ref_name }}" || echo "No changes to commit" + git push origin HEAD:main + + - name: Create Gitea release and upload IPA + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + TAG="${{ github.ref_name }}" + REPO="${{ github.repository }}" + API="https://git.silverlabs.uk/api/v1" + + # Create release + RELEASE_ID=$(curl -s -X POST "$API/repos/$REPO/releases" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"SilverApple $TAG\",\"body\":\"AltStore release $TAG\",\"draft\":false,\"prerelease\":false}" \ + | jq -r '.id') + + # Upload IPA asset + curl -s -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets" \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@SilverApple.ipa;type=application/octet-stream" diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..894f699 --- /dev/null +++ b/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version: 5.9 +import PackageDescription + +let package = Package( + name: "SilverApple", + platforms: [ + .iOS(.v16) + ], + targets: [ + .executableTarget( + name: "SilverApple", + path: "SilverApple", + exclude: [ + "Info.plist", + "SilverApple.entitlements", + ], + resources: [ + .process("Assets.xcassets"), + ], + linkerSettings: [ + .linkedFramework("AuthenticationServices"), + .linkedFramework("SafariServices"), + .linkedFramework("Security"), + ] + ), + .testTarget( + name: "SilverAppleTests", + dependencies: ["SilverApple"], + path: "SilverAppleTests" + ), + ] +) diff --git a/altstore-source.json b/altstore-source.json new file mode 100644 index 0000000..e23e508 --- /dev/null +++ b/altstore-source.json @@ -0,0 +1,24 @@ +{ + "name": "SilverLABS", + "identifier": "uk.silverlabs.source", + "subtitle": "Privacy-first apps by SilverLABS", + "description": "SilverLABS app distribution — compatible with AltStore and SideStore.", + "iconURL": "https://git.silverlabs.uk/SilverLABS/SilverApple/raw/branch/main/SilverApple/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png", + "website": "https://silverlabs.uk", + "tintColor": "00BBFF", + "apps": [ + { + "name": "SilverApple", + "bundleIdentifier": "uk.silverlabs.silverapple", + "developerName": "SilverLABS", + "downloadURL": "", + "subtitle": "Privacy companion for iOS", + "localizedDescription": "SilverApple integrates your device with the SilverLABS ecosystem — MDM enrollment, privacy hardening checks, and Passport authentication.", + "iconURL": "https://git.silverlabs.uk/SilverLABS/SilverApple/raw/branch/main/SilverApple/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png", + "tintColor": "00BBFF", + "category": "utilities", + "versions": [] + } + ], + "news": [] +} diff --git a/project.yml b/project.yml deleted file mode 100644 index 5f285b7..0000000 --- a/project.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: SilverApple - -options: - bundleIdPrefix: uk.silverlabs - deploymentTarget: - iOS: "16.0" - xcodeVersion: "15.0" - createIntermediateGroups: true - groupSortPosition: top - -settings: - base: - SWIFT_VERSION: "5.9" - DEVELOPMENT_TEAM: "" # Fill in your Apple Developer Team ID before building - CODE_SIGN_STYLE: Automatic - ENABLE_BITCODE: false - -targets: - SilverApple: - type: application - platform: iOS - deploymentTarget: "16.0" - sources: - - path: SilverApple - settings: - base: - PRODUCT_BUNDLE_IDENTIFIER: uk.silverlabs.silverapple - INFOPLIST_FILE: SilverApple/Info.plist - CODE_SIGN_ENTITLEMENTS: SilverApple/SilverApple.entitlements - ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon - TARGETED_DEVICE_FAMILY: "1" # iPhone only - dependencies: - - framework: AuthenticationServices.framework - embed: false - - framework: SafariServices.framework - embed: false - - framework: Security.framework - embed: false - - SilverAppleTests: - type: bundle.unit-test - platform: iOS - deploymentTarget: "16.0" - sources: - - path: SilverAppleTests - settings: - base: - PRODUCT_BUNDLE_IDENTIFIER: uk.silverlabs.silverapple.tests - dependencies: - - target: SilverApple diff --git a/xtool.yml b/xtool.yml new file mode 100644 index 0000000..8398752 --- /dev/null +++ b/xtool.yml @@ -0,0 +1,13 @@ +# xTool configuration — https://xtool.sh +# Run `xtool configure` once to set up your Apple ID credentials and Darwin SDK. +# Then: `xtool run` to build and install directly to a connected device. + +targets: + SilverApple: + bundleIdentifier: uk.silverlabs.silverapple + # Fill in your Apple Developer Team ID (10-char string from developer.apple.com) + teamID: "" + infoPlist: SilverApple/Info.plist + entitlements: SilverApple/SilverApple.entitlements + deploymentTarget: "16.0" + deviceFamily: [iphone]