Skip to content

Commit 659a444

Browse files
committed
Adding Cocoapods deployment
1 parent 6f50c01 commit 659a444

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

.github/workflows/xcframework-release.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,26 @@ 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+
# Install Cocoapods
112+
gem install cocoapods
113+
114+
# Get the current release tag name (version) from GitHub
115+
# This ensures the podspec uses the same version as the GitHub release
116+
export POD_VERSION=$(gh release list -R 21-DOT-DEV/swift-secp256k1 -L 1 --json tagName --jq '.[0].tagName')
117+
118+
# Calculate SHA256 checksum of the XCFramework zip file
119+
# CocoaPods requires this hash for security verification when downloading the binary
120+
export XCFRAMEWORK_SHA=$(shasum -a 256 P256K.xcframework.zip | awk '{print $1}')
121+
122+
# Validate the podspec using the environment variables set above
123+
# This checks that the podspec is valid before attempting to publish
124+
pod spec lint Projects/swift-secp256k1.podspec
125+
126+
# Push the podspec to the CocoaPods Trunk service
127+
# This publishes the new version of the pod to the CocoaPods registry
128+
pod trunk push Projects/swift-secp256k1.podspec
129+
env:
130+
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)