# Publishing the JanusSDK for iOS

This document outlines the process for publishing the JanusSDK for iOS as both a Swift Package and a CocoaPod.

## Current Approach: Direct Repository Reference

The current implementation commits the XCFramework zip file directly to the repository and references it directly using raw GitHub URLs.

### Steps for Publishing

FOLLOW IN INSTRUCTIONS IN THE README, THIS DOC IS LARGELY OBSOLETE AND ONLY KEPT AS A REFERENCE

### Advantages
- Industry-standard approach for binary framework distribution
- Keeps the git repository clean (no large binary files)
- Supports versioning through standard release workflows

## Future CI-Based Workflow

For a more automated approach, a CI pipeline could:

1. Trigger on tag creation (e.g., when a tag matching `v*` is pushed)
2. Run the `build_xcframework.sh` script to generate the XCFramework
3. Calculate the checksum automatically
4. Update the `Package.swift` file with the new checksum
5. Create a GitHub release programmatically 
6. Upload the XCFramework zip file as a release asset
7. Optionally, publish the podspec to a CocoaPods spec repository

### Implementation Notes

This could be implemented using GitHub Actions with a workflow like:

```yaml
name: Release iOS SDK

on:
  push:
    tags:
      - 'v*'

jobs:
  build-and-release:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      
      - name: Set version from tag
        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
        
      - name: Build XCFramework
        run: |
          cd iOS
          ./build_xcframework.sh
          
      - name: Calculate Checksum
        id: checksum
        run: |
          cd iOS/janus-sdk-ios
          CHECKSUM=$(swift package compute-checksum JanusSDK.xcframework.zip)
          echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
          
      - name: Update Package.swift
        run: |
          # Script to update Package.swift with new checksum
          
      - name: Create Release
        uses: softprops/action-gh-release@v1
        with:
          files: iOS/janus-sdk-ios/JanusSDK.xcframework.zip
          name: Release ${{ env.VERSION }}
          draft: false
          prerelease: false
```

## Conclusion

The current direct repository reference approach provides a simpler workflow for now. As the project matures, we can transition to the GitHub Releases approach for a cleaner repository and more standard distribution method. 