Skip to content

Commit

Permalink
ci: publish to cloudsmith and cocoapods
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyBedard committed Jun 17, 2024
1 parent 1ecd35b commit 931f38b
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 16 deletions.
69 changes: 61 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

# - 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
10 changes: 5 additions & 5 deletions Slauth.podspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
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

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
Binary file not shown.
Binary file added target/universal/release/libslauth_universal.a
Binary file not shown.
Binary file added target/x86_64-apple-ios/release/libslauth_x86.a
Binary file not shown.
8 changes: 5 additions & 3 deletions wrappers/swift/build.sh
Original file line number Diff line number Diff line change
@@ -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
# 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

0 comments on commit 931f38b

Please sign in to comment.