Merge pull request #1 from Kapusch/phase2/ai-ready-baseline #3
Workflow file for this run
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
| name: publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| pack_and_publish: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine package version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.ref }}" =~ ^refs/tags/v ]]; then | |
| REF="${{ github.ref }}" | |
| VERSION="${REF#refs/tags/v}" | |
| else | |
| CSPROJ="src/Kapusch.FacebookApisForiOSComponents/Kapusch.FacebookApisForiOSComponents.csproj" | |
| BASE_VERSION=$(grep -oE '<Version>[^<]+' "$CSPROJ" | head -n 1 | sed 's/<Version>//' || echo "0.1.0") | |
| COMMIT_SHORT=$(git rev-parse --short HEAD) | |
| RUN_NUMBER="${{ github.run_number }}" | |
| VERSION="${BASE_VERSION}-prerelease.${RUN_NUMBER}.${COMMIT_SHORT}" | |
| fi | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Package version: ${VERSION}" | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Install iOS workload | |
| run: | | |
| dotnet workload install ios | |
| - name: Cache NuGet | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', '**/*.csproj') }} | |
| - name: Cache SwiftPM scratch | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| src/Kapusch.FacebookApisForiOSComponents/Native/iOS/build/spm | |
| key: ${{ runner.os }}-swiftpm-${{ hashFiles('src/Kapusch.FacebookApisForiOSComponents/Native/iOS/KapuschFacebookAuthInterop/Package.resolved') }} | |
| - name: Build iOS wrapper | |
| run: | | |
| bash src/Kapusch.FacebookApisForiOSComponents/Native/iOS/build.sh | |
| - name: Collect Facebook xcframeworks | |
| run: | | |
| bash src/Kapusch.FacebookApisForiOSComponents/Native/iOS/collect-facebook-xcframeworks.sh | |
| - name: Pack | |
| run: | | |
| dotnet pack src/Kapusch.FacebookApisForiOSComponents/Kapusch.FacebookApisForiOSComponents.csproj \ | |
| -c Release \ | |
| -o artifacts/nuget \ | |
| /p:PackageVersion="${{ steps.version.outputs.version }}" | |
| - name: Validate nupkg layout | |
| run: | | |
| python3 - <<'PY' | |
| import glob, sys, zipfile | |
| nupkgs = glob.glob("artifacts/nuget/*.nupkg") | |
| if not nupkgs: | |
| print("ERROR: no .nupkg found under artifacts/nuget/") | |
| sys.exit(1) | |
| nupkg = sorted(nupkgs)[-1] | |
| print(f"Validating {nupkg}") | |
| z = zipfile.ZipFile(nupkg) | |
| names = set(z.namelist()) | |
| required = [ | |
| "buildTransitive/Kapusch.Facebook.iOS.targets", | |
| "kfb.xcframework/Info.plist", | |
| "fb/FBAEMKit.xcframework/Info.plist", | |
| "fb/FBSDKCoreKit.xcframework/Info.plist", | |
| "fb/FBSDKCoreKit_Basics.xcframework/Info.plist", | |
| "fb/FBSDKGamingServicesKit.xcframework/Info.plist", | |
| "fb/FBSDKLoginKit.xcframework/Info.plist", | |
| "fb/FBSDKShareKit.xcframework/Info.plist", | |
| ] | |
| missing = [p for p in required if p not in names] | |
| if missing: | |
| print("ERROR: missing required paths in nupkg:") | |
| for p in missing: | |
| print(f" - {p}") | |
| sys.exit(1) | |
| if "Info.plist" in names: | |
| print("ERROR: wrapper appears flattened (found 'Info.plist' at package root).") | |
| sys.exit(1) | |
| print("OK: nupkg layout looks correct.") | |
| PY | |
| - name: Push to GitHub Packages | |
| env: | |
| NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| dotnet nuget push artifacts/nuget/*.nupkg \ | |
| --api-key "$NUGET_AUTH_TOKEN" \ | |
| --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ | |
| --skip-duplicate |