Skip to content

Commit 3634b0e

Browse files
committed
Adding Cocoapods deployment
1 parent 6f50c01 commit 3634b0e

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

.github/workflows/xcframework-release.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,34 @@ jobs:
105105
7z a -tzip -mx=9 P256K.xcframework.zip P256K.xcframework LICENSE "COPYING-libsecp256k1"
106106
- name: Upload XCFramework
107107
run: |
108-
gh release upload ${{ github.ref_name }} P256K.xcframework.zip
108+
gh release upload ${{ github.ref_name }} P256K.xcframework.zip
109+
- name: Deploy to Cocoapods
110+
run: |
111+
# Check if the token is available without printing it
112+
if [ -z "$COCOAPODS_TRUNK_TOKEN" ]; then
113+
echo "::error::COCOAPODS_TRUNK_TOKEN is not set or empty"
114+
exit 1
115+
else
116+
echo "::debug::COCOAPODS_TRUNK_TOKEN is set and not empty"
117+
fi
118+
119+
# Install Cocoapods
120+
gem install cocoapods
121+
122+
# Get the current release tag name (version) from GitHub
123+
# This ensures the podspec uses the same version as the GitHub release
124+
export POD_VERSION=$(gh release list -R 21-DOT-DEV/swift-secp256k1 -L 1 --json tagName --jq '.[0].tagName')
125+
126+
# Calculate SHA256 checksum of the XCFramework zip file
127+
# CocoaPods requires this hash for security verification when downloading the binary
128+
export XCFRAMEWORK_SHA=$(shasum -a 256 P256K.xcframework.zip | awk '{print $1}')
129+
130+
# Validate the podspec using the environment variables set above
131+
# This checks that the podspec is valid before attempting to publish
132+
pod spec lint Projects/swift-secp256k1.podspec
133+
134+
# Push the podspec to the CocoaPods Trunk service
135+
# This publishes the new version of the pod to the CocoaPods registry
136+
#pod trunk push Projects/swift-secp256k1.podspec
137+
env:
138+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

Projects/swift-secp256k1.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
33
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
44

55
s.name = "swift-secp256k1"
6-
s.version = "0.20.0-prerelease-1"
6+
s.version = ENV["POD_VERSION"] || "0.20.0-prerelease-2" #fallback to first version
77
s.summary = "P256K: Elliptic curve public key cryptography, ECDH, and Schnorr Signatures for Bitcoin."
88
s.description = "Open-source library for a substantial portion of the APIs of libsecp256k1. Written in Swift for native iOS, macOS, tvOS, watchOS, and visionOS."
99
s.homepage = "https://github.com/21-DOT-DEV/swift-secp256k1"
@@ -29,7 +29,7 @@ Pod::Spec.new do |s|
2929

3030
s.source = {
3131
:http => "https://github.com/21-DOT-DEV/swift-secp256k1/releases/download/#{s.version}/P256K.xcframework.zip",
32-
:sha256 => "3ba806e07fadd0c4201135d7219be7128652f2f7612fb348d02c6891d857d047"
32+
:sha256 => ENV['XCFRAMEWORK_SHA'] || "d16232638a97f1e18a68ce97dcea1e12c3276bc0ecff37e50e50e44b92bd579b" #fallback to first version sha
3333
}
3434

3535
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

0 commit comments

Comments
 (0)