diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9d045ac..6b43f04 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,13 +8,18 @@ on: default: false required: true type: boolean + android: + description: Publish an android version (maven) + default: true + required: true + type: boolean rust: description: Publish a rust version (crates.io) default: true required: true type: boolean - android: - description: Publish an android version (maven) + swift: + description: Publish a swift version (cocoapods) default: true required: true type: boolean @@ -109,15 +114,13 @@ jobs: rustup target add x86_64-unknown-linux-gnu - name: Build - run: | - cd wrappers/android - sh build.sh + run: sh wrappers/android/build.sh - name: Create local.properties - run: | - echo "sdk.dir=$ANDROID_HOME" > local.properties + run: echo "sdk.dir=$ANDROID_HOME" > local.properties - - run: chmod +x gradlew + - name: Allow gradlew to run + run: chmod +x gradlew - name: Package .aar run: ./gradlew clean assembleRelease @@ -148,3 +151,53 @@ jobs: run: cargo publish env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + build-swift: + environment: cocoapods-publish + if: ${{ inputs.swift }} + runs-on: macos-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - run: | + rustup target add aarch64-apple-ios + rustup target add x86_64-apple-ios + + - name: Build iOS libraries + run: sh wrappers/swift/build.sh + + # - name: Move files + # run: | + # mv LICENSE target + # mv ./slauth.h target + + # - name: Package binaries + # run: | + # tar -czvf Slauth.tar.gz target + + # - name: Checkout action + # uses: actions/checkout@v4 + # with: + # repository: Devolutions/actions + # path: actions + # ref: v1 + # token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }} + + # - name: Upload files to storage account + # uses: ./actions/azure-storage-blob-upload + # with: + # azure_client_id: ${{ secrets.DEVMANAGER_CLIENT_ID }} + # azure_client_secret: ${{ secrets.DEVMANAGER_CLIENT_SECRET }} + # azure_tenant_id: ${{ secrets.AZURE_TENANT_ID }} + # container: download + # files: Slauth.tar.gz #'target/universal/release/libslauth_universal.a;target/x86_64-apple-ios/release/libslauth_x86.a;target/aarch64-apple-ios/release/libslauth_arm64.a;target/slauth.h' + # resource_group: cdndevolutions-prod + # storage_account: cdndevolutions + + - run: pod spec lint --verbose + + # - name: Update Podspec + # run: | + # sed -i '' "s|spec.source = { :git => '.*', :tag => s.version.to_s }|spec.source = { :http => 'URL_to_Slauth-${{ github.ref_name }}.tar.gz' }|g" Slauth.podspec diff --git a/Slauth.podspec b/Slauth.podspec index a0cab4e..7000cea 100644 --- a/Slauth.podspec +++ b/Slauth.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Slauth' s.version = '0.7.6' - s.summary = 'A Swift wrapper aroud Slauth Rust crate' + s.summary = 'A Swift wrapper around Slauth Rust crate' s.description = <<-DESC TODO: Add long description of the pod here. DESC @@ -9,11 +9,11 @@ TODO: Add long description of the pod here. s.homepage = 'https://github.com/Devolutions/Slauth.git' s.license = { :type => 'MIT', :file => './LICENSE' } s.author = { 'Devolutions' => 'lfauvel@devolutions.net' } - s.source = { :git => 'https://github.com/Devolutions/Slauth.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/Devolutions/Slauth.git', :branch => 'devops/cloudsmith-cocoapods' } s.swift_version = '5.0' - s.ios.deployment_target = '11.0' - + s.ios.deployment_target = '17.0' + s.source_files = 'wrappers/swift/classes/**/*', 'slauth.h' - s.vendored_libraries = 'target/universal/release/*.a', 'target/x86_64-apple-io/release/*.a', 'target/aarch64-apple-ios/release/*.a' + s.vendored_libraries = 'target/universal/release/*.a' end diff --git a/target/aarch64-apple-ios/release/libslauth_arm64.a b/target/aarch64-apple-ios/release/libslauth_arm64.a new file mode 100644 index 0000000..58c433a Binary files /dev/null and b/target/aarch64-apple-ios/release/libslauth_arm64.a differ diff --git a/target/universal/release/libslauth_universal.a b/target/universal/release/libslauth_universal.a new file mode 100644 index 0000000..2d2de06 Binary files /dev/null and b/target/universal/release/libslauth_universal.a differ diff --git a/target/x86_64-apple-ios/release/libslauth_x86.a b/target/x86_64-apple-ios/release/libslauth_x86.a new file mode 100644 index 0000000..3d5ce0a Binary files /dev/null and b/target/x86_64-apple-ios/release/libslauth_x86.a differ diff --git a/wrappers/swift/build.sh b/wrappers/swift/build.sh index 9713b30..fd39e76 100755 --- a/wrappers/swift/build.sh +++ b/wrappers/swift/build.sh @@ -1,4 +1,6 @@ +cargo install cargo-lipo + cargo lipo --release -mv target/universal/release/libslauth.a target/universal/release/libslauth_universal.a -mv target/x86_64-apple-ios/release/libslauth.a target/x86_64-apple-ios/release/libslauth_x86.a -mv target/aarch64-apple-ios/release/libslauth.a target/aarch64-apple-ios/release/libslauth_arm64.a \ No newline at end of file +# mv target/universal/release/libslauth.a target/universal/release/libslauth_universal.a +# mv target/x86_64-apple-ios/release/libslauth.a target/x86_64-apple-ios/release/libslauth_x86.a +# mv target/aarch64-apple-ios/release/libslauth.a target/aarch64-apple-ios/release/libslauth_arm64.a