mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-21 11:31:25 +02:00
119 lines
3.6 KiB
YAML
119 lines
3.6 KiB
YAML
name: iOS Build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-ios:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.21'
|
|
cache-dependency-path: go_backend/go.sum
|
|
|
|
- name: Install gomobile
|
|
run: |
|
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
|
gomobile init
|
|
|
|
- name: Build Go backend for iOS (XCFramework)
|
|
working-directory: go_backend
|
|
run: |
|
|
mkdir -p ../ios/Frameworks
|
|
gomobile bind -target=ios -o ../ios/Frameworks/Gobackend.xcframework .
|
|
env:
|
|
CGO_ENABLED: 1
|
|
|
|
- name: Verify XCFramework created
|
|
run: |
|
|
echo "=== Checking XCFramework ==="
|
|
ls -la ios/Frameworks/
|
|
ls -la ios/Frameworks/Gobackend.xcframework/ || (echo "ERROR: XCFramework not found!" && exit 1)
|
|
|
|
- name: Add XCFramework to Xcode project
|
|
run: |
|
|
# Install xcodeproj gem for modifying Xcode project
|
|
sudo gem install xcodeproj
|
|
|
|
# Create Ruby script to add framework
|
|
cat > add_framework.rb << 'EOF'
|
|
require 'xcodeproj'
|
|
|
|
project_path = 'ios/Runner.xcodeproj'
|
|
project = Xcodeproj::Project.open(project_path)
|
|
|
|
# Get the main target
|
|
target = project.targets.find { |t| t.name == 'Runner' }
|
|
|
|
# Get or create Frameworks group
|
|
frameworks_group = project.main_group.find_subpath('Frameworks', true)
|
|
frameworks_group ||= project.main_group.new_group('Frameworks')
|
|
|
|
# Add XCFramework reference
|
|
framework_path = 'Frameworks/Gobackend.xcframework'
|
|
framework_ref = frameworks_group.new_file(framework_path, :project)
|
|
|
|
# Add to frameworks build phase
|
|
frameworks_build_phase = target.frameworks_build_phase
|
|
frameworks_build_phase.add_file_reference(framework_ref)
|
|
|
|
# Add to embed frameworks build phase
|
|
embed_phase = target.build_phases.find { |p| p.is_a?(Xcodeproj::Project::Object::PBXCopyFilesBuildPhase) && p.name == 'Embed Frameworks' }
|
|
if embed_phase
|
|
build_file = embed_phase.add_file_reference(framework_ref)
|
|
build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] }
|
|
end
|
|
|
|
project.save
|
|
puts "Successfully added Gobackend.xcframework to Xcode project"
|
|
EOF
|
|
|
|
ruby add_framework.rb
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: 'stable'
|
|
cache: true
|
|
|
|
- name: Get Flutter dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Generate app icons
|
|
run: dart run flutter_launcher_icons
|
|
|
|
- name: Build iOS (no codesign)
|
|
run: flutter build ios --release --no-codesign
|
|
|
|
- name: Create IPA (unsigned)
|
|
run: |
|
|
mkdir -p build/ios/ipa
|
|
cd build/ios/iphoneos
|
|
mkdir Payload
|
|
cp -r Runner.app Payload/
|
|
zip -r ../ipa/SpotiFLAC-unsigned.ipa Payload
|
|
rm -rf Payload
|
|
|
|
- name: Upload IPA artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: SpotiFLAC-iOS-unsigned
|
|
path: build/ios/ipa/SpotiFLAC-unsigned.ipa
|
|
retention-days: 30
|
|
|
|
- name: Upload XCFramework artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Gobackend-XCFramework
|
|
path: ios/Frameworks/Gobackend.xcframework
|
|
retention-days: 30
|