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"