Private
Public Access
1
0

chore(ci): switch to Codemagic for iOS builds

Replace self-hosted macOS runner (SLAB01 VM) with Codemagic cloud CI.
- Add codemagic.yaml: builds unsigned IPA with xcodebuild, publishes
  Gitea release and updates altstore-source.json on v* tag push
- Remove .gitea/workflows/release.yml (requires unavailable runner)
- Gitea webhook registered to forward tag pushes to Codemagic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 11:47:24 +01:00
parent a745e0a279
commit de514fc425
2 changed files with 90 additions and 92 deletions

View File

@@ -1,92 +0,0 @@
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"

90
codemagic.yaml Normal file
View File

@@ -0,0 +1,90 @@
workflows:
ios-release:
name: SilverApple iOS Release
instance_type: mac_mini_m2
max_build_duration: 30
triggering:
events:
- tag
tag_patterns:
- pattern: 'v*'
include: true
environment:
xcode: latest
vars:
BUNDLE_ID: uk.silverlabs.silverapple
GITEA_REPO: SilverLABS/SilverApple
GITEA_API: https://git.silverlabs.uk/api/v1
# GITEA_TOKEN — set this in Codemagic App Settings → Environment variables (mark as secret)
scripts:
- name: Build archive (unsigned)
script: |
xcodebuild archive \
-scheme SilverApple \
-destination "generic/platform=iOS" \
-archivePath "$CM_BUILD_DIR/SilverApple.xcarchive" \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY="" \
PROVISIONING_PROFILE=""
- name: Package IPA
script: |
cd "$CM_BUILD_DIR"
mkdir -p Payload
cp -r SilverApple.xcarchive/Products/Applications/SilverApple.app Payload/
zip -r SilverApple.ipa Payload/
rm -rf Payload
echo "IPA size: $(du -sh SilverApple.ipa | cut -f1)"
- name: Publish to Gitea
script: |
set -e
TAG="$CM_TAG"
VERSION="${TAG#v}"
IPA="$CM_BUILD_DIR/SilverApple.ipa"
SHA256=$(shasum -a 256 "$IPA" | awk '{print $1}')
SIZE=$(wc -c < "$IPA" | tr -d ' ')
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
DOWNLOAD_URL="https://git.silverlabs.uk/$GITEA_REPO/releases/download/$TAG/SilverApple.ipa"
# Update altstore-source.json
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
# Commit and push updated source
git remote set-url origin "https://sysadmin:$GITEA_TOKEN@git.silverlabs.uk/$GITEA_REPO.git"
git config user.name "Codemagic"
git config user.email "ci@silverlabs.uk"
git add altstore-source.json
git commit -m "chore(altstore): update source for $TAG" || echo "No changes"
git push origin HEAD:main
# Create Gitea release
RELEASE_ID=$(curl -sf -X POST "$GITEA_API/repos/$GITEA_REPO/releases" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"SilverApple $TAG\",\"body\":\"AltStore / SideStore release.\",\"draft\":false,\"prerelease\":false}" \
| jq -r '.id')
# Upload IPA
curl -sf -X POST "$GITEA_API/repos/$GITEA_REPO/releases/$RELEASE_ID/assets" \
-H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@$IPA;type=application/octet-stream"
echo "Published release $TAG → $DOWNLOAD_URL"
artifacts:
- $CM_BUILD_DIR/SilverApple.ipa