Skip to content

Commit 2e7db25

Browse files
committed
ci: publish to cloudsmith and cocoapods
1 parent 1ecd35b commit 2e7db25

File tree

3 files changed

+63
-14
lines changed

3 files changed

+63
-14
lines changed

.github/workflows/publish.yml

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ on:
88
default: false
99
required: true
1010
type: boolean
11+
android:
12+
description: Publish an android version (maven)
13+
default: true
14+
required: true
15+
type: boolean
1116
rust:
1217
description: Publish a rust version (crates.io)
1318
default: true
1419
required: true
1520
type: boolean
16-
android:
17-
description: Publish an android version (maven)
21+
swift:
22+
description: Publish a swift version (cocoapods)
1823
default: true
1924
required: true
2025
type: boolean
@@ -109,15 +114,13 @@ jobs:
109114
rustup target add x86_64-unknown-linux-gnu
110115
111116
- name: Build
112-
run: |
113-
cd wrappers/android
114-
sh build.sh
117+
run: sh wrappers/android/build.sh
115118

116119
- name: Create local.properties
117-
run: |
118-
echo "sdk.dir=$ANDROID_HOME" > local.properties
120+
run: echo "sdk.dir=$ANDROID_HOME" > local.properties
119121

120-
- run: chmod +x gradlew
122+
- name: Allow gradlew to run
123+
run: chmod +x gradlew
121124

122125
- name: Package .aar
123126
run: ./gradlew clean assembleRelease
@@ -148,3 +151,49 @@ jobs:
148151
run: cargo publish
149152
env:
150153
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
154+
155+
build-swift:
156+
environment: cocoapods-publish
157+
if: ${{ inputs.swift }}
158+
runs-on: macos-latest
159+
160+
steps:
161+
- name: Checkout repo
162+
uses: actions/checkout@v4
163+
164+
- name: Setup rust
165+
run: |
166+
rustup target add aarch64-apple-ios
167+
rustup target add x86_64-apple-ios
168+
cargo install cargo-lipo
169+
170+
- name: Build iOS libraries
171+
run: sh wrappers/swift/build.sh
172+
173+
# - name: Setup version
174+
# id: version
175+
# run: |
176+
# VERSION=$(grep -E "^\s*s\.version\s*=\s*['\"][0-9]+\.[0-9]+\.[0-9]+['\"]" Slauth.podspec | awk -F"[\"\']" '{print $2}')
177+
# echo "branch_name=release/cocoapods-v$VERSION" >> $GITHUB_OUTPUT
178+
179+
# - name: Push to a new branch
180+
# run: |
181+
# git checkout --orphan ${{ steps.version.outputs.branch_name }}
182+
# git rm -rf .
183+
# git checkout devops/cloudsmith-cocoapods -- LICENSE wrappers/swift/classes slauth.h Slauth.podspec
184+
# git add LICENSE wrappers/swift/classes/** slauth.h Slauth.podspec target/universal/release/* target/x86_64-apple-ios/release/* target/aarch64-apple-ios/release/*
185+
# git commit -m "Set up CocoaPods release branch"
186+
# git push origin ${{ steps.version.outputs.branch_name }}
187+
# env:
188+
# GITHUB_TOKEN: ${{ github.token }}
189+
190+
# - name: Update Podspec
191+
# run: sed -i '' "s|:branch => '.*'|:branch => '${{ steps.version.outputs.branch_name }}'|" Slauth.podspec
192+
193+
- name: Validate podspec
194+
run: pod spec lint --skip-import-validation --use-libraries --allow-warnings
195+
196+
- name: Publish to CocoaPods
197+
run: pod trunk push Slauth.podspec --skip-import-validation --use-libraries --allow-warnings
198+
env:
199+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

Slauth.podspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
Pod::Spec.new do |s|
22
s.name = 'Slauth'
33
s.version = '0.7.6'
4-
s.summary = 'A Swift wrapper aroud Slauth Rust crate'
4+
s.summary = 'A Swift wrapper around Slauth Rust crate'
55
s.description = <<-DESC
66
TODO: Add long description of the pod here.
77
DESC
88

99
s.homepage = 'https://github.com/Devolutions/Slauth.git'
1010
s.license = { :type => 'MIT', :file => './LICENSE' }
1111
s.author = { 'Devolutions' => 'lfauvel@devolutions.net' }
12-
s.source = { :git => 'https://github.com/Devolutions/Slauth.git', :tag => s.version.to_s }
12+
s.source = { :git => 'https://github.com/Devolutions/Slauth.git', :tag => '0.0.0' }
1313

1414
s.swift_version = '5.0'
15-
s.ios.deployment_target = '11.0'
16-
15+
s.ios.deployment_target = '17.0'
16+
1717
s.source_files = 'wrappers/swift/classes/**/*', 'slauth.h'
18-
s.vendored_libraries = 'target/universal/release/*.a', 'target/x86_64-apple-io/release/*.a', 'target/aarch64-apple-ios/release/*.a'
18+
s.vendored_libraries = 'target/universal/release/*.a', 'target/x86_64-apple-io/release/*.a', 'target/aarch64-apple-ios/release/*.a'
1919
end

wrappers/swift/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
cargo lipo --release
22
mv target/universal/release/libslauth.a target/universal/release/libslauth_universal.a
33
mv target/x86_64-apple-ios/release/libslauth.a target/x86_64-apple-ios/release/libslauth_x86.a
4-
mv target/aarch64-apple-ios/release/libslauth.a target/aarch64-apple-ios/release/libslauth_arm64.a
4+
mv target/aarch64-apple-ios/release/libslauth.a target/aarch64-apple-ios/release/libslauth_arm64.a

0 commit comments

Comments
 (0)