Package ably #67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================ | |
| # ACTIVE PACKAGING WORKFLOW - Uses Cake Build System | |
| # ============================================================================ | |
| # This is the primary workflow for creating NuGet packages and Unity packages. | |
| # | |
| # To create a release: | |
| # 1. Go to Actions tab → Package ably workflow | |
| # 2. Click "Run workflow" and enter the version number (e.g., 1.2.3) | |
| # 3. Download artifacts: | |
| # - ably-package: Main NuGet packages (.nupkg) | |
| # - ably-push-package: Push notification packages (.nupkg) | |
| # - ably-unity-package: Unity package (.unitypackage) | |
| # ============================================================================ | |
| name: Package ably | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Ably version' | |
| required: true | |
| jobs: | |
| package-library: | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Download dotnet framework | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 3.1.426 | |
| 6.0.428 | |
| 7.0.410 | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android SDK Platform 30 | |
| shell: pwsh | |
| run: | | |
| echo "y" | & "$env:ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager.bat" "platforms;android-30" | |
| echo "y" | & "$env:ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager.bat" "build-tools;30.0.3" | |
| - name: Install legacy Xamarin | |
| shell: pwsh | |
| run: | | |
| # Install Xamarin.Android and Xamarin.iOS components via VS installer | |
| Write-Host "Installing Xamarin workload for VS 2022..." | |
| Write-Host "This may take several minutes..." | |
| & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify ` | |
| --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ` | |
| --add Microsoft.VisualStudio.Workload.XamarinBuildTools ` | |
| --add Component.Xamarin ` | |
| --wait | |
| Write-Host "Xamarin installation completed" | |
| # Verify installation | |
| Write-Host "Verifying Xamarin.iOS targets..." | |
| if (-not (Test-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.CSharp.targets")) { | |
| Write-Error "Xamarin.iOS targets not found at expected path" | |
| exit 1 | |
| } | |
| Write-Host "Verified Xamarin.iOS installation" | |
| Write-Host "Verifying Xamarin.Android targets..." | |
| if (-not (Test-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.CSharp.targets")) { | |
| Write-Error "Xamarin.Android targets not found at expected path" | |
| exit 1 | |
| } | |
| Write-Host "Verified Xamarin.Android installation" | |
| - name: Download cake tool | |
| run: dotnet tool restore | |
| - name: Package | |
| run: ./package.cmd ${{ github.event.inputs.version }} | |
| - name: Archive package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ably-package | |
| path: | | |
| ${{ github.workspace }}/*.nupkg | |
| package-push: | |
| runs-on: macos-13 | |
| env: | |
| DOTNET_NOLOGO: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Setup Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '14.3' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android SDK Platform 30 | |
| run: | | |
| yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "platforms;android-30" | |
| yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "build-tools;30.0.3" | |
| - name: Download dotnet framework | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 3.1.426 | |
| 6.0.428 | |
| 7.0.410 | |
| - name: Install legacy Xamarin | |
| run: | | |
| # macOS 13 runners should have Xamarin pre-installed | |
| # Verify Xamarin.iOS and Xamarin.Android are available | |
| ls -la "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/" || true | |
| ls -la "/Library/Frameworks/Xamarin.iOS.framework/" || true | |
| # If not found, install via brew | |
| if [ ! -d "/Library/Frameworks/Xamarin.iOS.framework/" ]; then | |
| echo "Installing Xamarin via brew..." | |
| brew install --cask xamarin-ios || true | |
| brew install --cask xamarin-android || true | |
| fi | |
| - name: Download cake tool | |
| run: dotnet tool restore | |
| - name: Package Push (iOS & Android) | |
| run: ./package-push.sh ${{ github.event.inputs.version }} | |
| - name: Archive push packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ably-push-package | |
| path: | | |
| ${{ github.workspace }}/*.nupkg | |
| package-unity: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Download dotnet framework | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 2.1.818 | |
| 6.0.428 | |
| - name: Download cake tool | |
| run: dotnet tool restore | |
| - name: Package Unity | |
| run: ./package-unity.sh ${{ github.event.inputs.version }} | |
| - name: Archive Unity package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ably-unity-package | |
| path: | | |
| ${{ github.workspace }}/*.unitypackage | |
| merge-artifacts: | |
| runs-on: ubuntu-22.04 | |
| needs: [package-library, package-push, package-unity] | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Merge artifacts into single directory | |
| run: | | |
| mkdir -p output-package | |
| # Copy all .nupkg files from ably-package | |
| if [ -d "artifacts/ably-package" ]; then | |
| find artifacts/ably-package -name "*.nupkg" -exec cp {} output-package/ \; | |
| echo "Copied .nupkg files from ably-package" | |
| else | |
| echo "Warning: ably-package artifact not found" | |
| fi | |
| # Copy all .nupkg files from ably-push-package | |
| if [ -d "artifacts/ably-push-package" ]; then | |
| find artifacts/ably-push-package -name "*.nupkg" -exec cp {} output-package/ \; | |
| echo "Copied .nupkg files from ably-push-package" | |
| else | |
| echo "Warning: ably-push-package artifact not found" | |
| fi | |
| # Copy .unitypackage file | |
| if [ -d "artifacts/ably-unity-package" ]; then | |
| find artifacts/ably-unity-package -name "*.unitypackage" -exec cp {} output-package/ \; | |
| echo "Copied .unitypackage files from ably-unity-package" | |
| else | |
| echo "Warning: ably-unity-package artifact not found" | |
| fi | |
| # Verify we have files and list merged contents | |
| if [ -z "$(ls -A output-package)" ]; then | |
| echo "Error: No files were copied to output-package" | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "Merged artifact contents:" | |
| ls -lh output-package/ | |
| echo "" | |
| echo "Total files: $(ls -1 output-package | wc -l)" | |
| - name: Upload merged artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: output-package | |
| path: output-package/ |