v0.2.3 #17
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: Flutter Release | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (e.g., 0.2.0)' | |
| required: true | |
| type: string | |
| env: | |
| CARGO_TERM_COLOR: always | |
| FLUTTER_VERSION: '3.24.0' | |
| jobs: | |
| # Generate Dart bindings | |
| generate-bindings: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install LLVM/Clang | |
| run: sudo apt-get update && sudo apt-get install -y libclang-dev llvm-dev | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-frb-release | |
| - name: Install flutter_rust_bridge_codegen | |
| run: cargo install flutter_rust_bridge_codegen | |
| - name: Get Flutter dependencies | |
| working-directory: packages/fula_client | |
| run: flutter pub get | |
| - name: Generate Dart bindings | |
| run: flutter_rust_bridge_codegen generate | |
| - name: Analyze Dart code | |
| working-directory: packages/fula_client | |
| run: flutter analyze | |
| - name: Upload Flutter package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: flutter-package | |
| path: packages/fula_client/ | |
| retention-days: 1 | |
| # Build Android native libraries | |
| build-android: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: aarch64-linux-android | |
| lib_dir: arm64-v8a | |
| cc: aarch64-linux-android21-clang | |
| ar: llvm-ar | |
| - target: armv7-linux-androideabi | |
| lib_dir: armeabi-v7a | |
| cc: armv7a-linux-androideabi21-clang | |
| ar: llvm-ar | |
| - target: x86_64-linux-android | |
| lib_dir: x86_64 | |
| cc: x86_64-linux-android21-clang | |
| ar: llvm-ar | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Setup Android NDK | |
| uses: nttld/setup-ndk@v1 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r25c | |
| add-to-path: true | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-android-release-${{ matrix.target }} | |
| - name: Configure linker for Android | |
| run: | | |
| mkdir -p .cargo | |
| cat >> .cargo/config.toml << INNEREOF | |
| [target.aarch64-linux-android] | |
| linker = "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang" | |
| [target.armv7-linux-androideabi] | |
| linker = "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang" | |
| [target.x86_64-linux-android] | |
| linker = "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang" | |
| INNEREOF | |
| - name: Build for Android | |
| env: | |
| CC: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.cc }} | |
| AR: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.ar }} | |
| run: cargo build -p fula-flutter --target ${{ matrix.target }} --release | |
| - name: Strip debug symbols | |
| run: | | |
| ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip \ | |
| target/${{ matrix.target }}/release/libfula_flutter.so | |
| - name: Prepare artifact | |
| run: | | |
| mkdir -p android-libs/${{ matrix.lib_dir }} | |
| cp target/${{ matrix.target }}/release/libfula_flutter.so android-libs/${{ matrix.lib_dir }}/ | |
| - name: Upload Android library | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-${{ matrix.lib_dir }} | |
| path: android-libs/ | |
| retention-days: 1 | |
| # Build iOS native libraries | |
| build-ios: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-ios-release | |
| - name: Build for iOS arm64 | |
| run: cargo build -p fula-flutter --target aarch64-apple-ios --release | |
| - name: Build for iOS x86_64 simulator | |
| run: cargo build -p fula-flutter --target x86_64-apple-ios --release | |
| - name: Build for iOS arm64 simulator | |
| run: cargo build -p fula-flutter --target aarch64-apple-ios-sim --release | |
| - name: Strip debug symbols from iOS libraries | |
| run: | | |
| strip -S target/aarch64-apple-ios/release/libfula_flutter.a | |
| strip -S target/x86_64-apple-ios/release/libfula_flutter.a | |
| strip -S target/aarch64-apple-ios-sim/release/libfula_flutter.a | |
| - name: Create XCFramework | |
| run: | | |
| mkdir -p ios-libs | |
| # Create simulator universal library | |
| mkdir -p target/ios-sim-universal | |
| lipo -create \ | |
| target/x86_64-apple-ios/release/libfula_flutter.a \ | |
| target/aarch64-apple-ios-sim/release/libfula_flutter.a \ | |
| -output target/ios-sim-universal/libfula_flutter.a | |
| # Create XCFramework | |
| xcodebuild -create-xcframework \ | |
| -library target/aarch64-apple-ios/release/libfula_flutter.a \ | |
| -library target/ios-sim-universal/libfula_flutter.a \ | |
| -output ios-libs/FulaFlutter.xcframework | |
| - name: Upload iOS libraries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ios-xcframework | |
| path: ios-libs/ | |
| retention-days: 1 | |
| # Build WASM package | |
| build-wasm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-wasm-release | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack | |
| - name: Build WASM | |
| run: | | |
| cd crates/fula-flutter | |
| wasm-pack build --release --target web --out-dir ../../wasm-package | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create npm package.json | |
| run: | | |
| cd wasm-package | |
| cat > package.json << INNEREOF | |
| { | |
| "name": "@functionland/fula-client", | |
| "version": "${{ steps.version.outputs.version }}", | |
| "description": "Fula encrypted storage SDK for JavaScript/WASM", | |
| "main": "fula_flutter.js", | |
| "types": "fula_flutter.d.ts", | |
| "files": ["*.js", "*.wasm", "*.d.ts", "snippets/**"], | |
| "repository": { | |
| "type": "git", | |
| "url": "https://github.com/functionland/fula-api" | |
| }, | |
| "keywords": ["fula", "storage", "encryption", "wasm", "decentralized"], | |
| "author": "Functionland", | |
| "license": "Apache-2.0" | |
| } | |
| INNEREOF | |
| - name: Upload WASM package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm-package | |
| path: wasm-package/ | |
| retention-days: 1 | |
| # Publish to pub.dev (Android only - iOS downloads from GitHub Releases) | |
| publish-pubdev: | |
| needs: [generate-bindings, build-android] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for pub.dev OIDC authentication | |
| steps: | |
| - name: Download Flutter package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: flutter-package | |
| path: packages/fula_client/ | |
| - name: Download Android arm64 library | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-arm64-v8a | |
| path: packages/fula_client/android/src/main/jniLibs/ | |
| - name: Download Android armv7 library | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-armeabi-v7a | |
| path: packages/fula_client/android/src/main/jniLibs/ | |
| - name: Download Android x86_64 library | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-x86_64 | |
| path: packages/fula_client/android/src/main/jniLibs/ | |
| # iOS binaries are NOT included - they're downloaded via podspec from GitHub Releases | |
| # This keeps the pub.dev package under 100MB limit | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| - name: Setup Dart for pub.dev OIDC | |
| uses: dart-lang/setup-dart@v1 | |
| - name: Verify package structure | |
| run: | | |
| echo "Package contents:" | |
| find packages/fula_client -type f | head -50 | |
| echo "" | |
| echo "Android libs:" | |
| ls -la packages/fula_client/android/src/main/jniLibs/ || echo "No jniLibs" | |
| echo "" | |
| echo "Package size estimate:" | |
| du -sh packages/fula_client/ | |
| - name: Publish to pub.dev (dry run) | |
| working-directory: packages/fula_client | |
| run: flutter pub publish --dry-run | |
| - name: Publish to pub.dev | |
| if: github.event_name == 'release' | |
| working-directory: packages/fula_client | |
| run: flutter pub publish --force | |
| # Publish to npm | |
| publish-npm: | |
| needs: [build-wasm] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download WASM package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm-package | |
| path: wasm-package/ | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Verify package contents | |
| run: | | |
| echo "WASM package contents:" | |
| ls -la wasm-package/ | |
| cat wasm-package/package.json | |
| - name: Publish to npm (dry run) | |
| working-directory: wasm-package | |
| run: npm publish --access public --dry-run | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish to npm | |
| if: github.event_name == 'release' | |
| working-directory: wasm-package | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # Create GitHub Release artifacts | |
| github-release: | |
| needs: [build-android, build-ios, build-wasm] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Package artifacts | |
| run: | | |
| cd artifacts | |
| # Package Android libs | |
| mkdir -p android-libs | |
| cp -r android-arm64-v8a/* android-libs/ | |
| cp -r android-armeabi-v7a/* android-libs/ | |
| cp -r android-x86_64/* android-libs/ | |
| zip -r android-libs.zip android-libs/ | |
| # Package iOS libs (must match podspec expected structure: Frameworks/FulaFlutter.xcframework) | |
| mkdir -p ios-package/Frameworks | |
| cp -r ios-xcframework/* ios-package/Frameworks/ | |
| cd ios-package && zip -r ../ios-libs.zip Frameworks/ && cd .. | |
| # Package WASM | |
| zip -r wasm-package.zip wasm-package/ | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| artifacts/android-libs.zip | |
| artifacts/ios-libs.zip | |
| artifacts/wasm-package.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |