Skip to content

Publish Swift Bindings #15

Publish Swift Bindings

Publish Swift Bindings #15

name: Publish Swift Bindings
on:
workflow_dispatch:
inputs:
version:
description: 'LWK repo release (MAJOR.MINOR.PATCH)'
required: true
type: string
jobs:
build-tag-release:
name: Build, tag, and release the LWK SDK Swift bindings
runs-on: macos-14
steps:
- name: ENV
run: env
- name: Set release version
run: |
echo "VERSION=$(echo ${{ inputs.version }} | sed 's/bindings_//')" >> $GITHUB_ENV
- name: Version
run: |
echo "New tag: ${VERSION}"
- name: Setup rust toolchain
uses: dtolnay/[email protected]
with:
targets: x86_64-apple-ios,aarch64-apple-ios,aarch64-apple-ios-sim
- name: Setup just
uses: extractions/setup-just@v2
with:
just-version: 1.5.0 # optional semver specification, otherwise latest
- name: Checkout lwk-swift repo
uses: actions/checkout@v4
with:
repository: Blockstream/lwk-swift
ref: main
- name: Checkout lwk repo
uses: actions/checkout@v4
with:
repository: Blockstream/lwk
ref: ${{ inputs.version }}
path: build
- uses: Swatinem/rust-cache@v2
- name: Build Swift bindings
working-directory: build
run: just swift
- name: Compress XCFramework
working-directory: build
run: |
cd target
zip -9 -r lwkFFI.xcframework.zip lwkFFI.xcframework
echo "XCF_CHECKSUM=`swift package compute-checksum lwkFFI.xcframework.zip`" >> $GITHUB_ENV
- name: Checksum
run: |
echo "XCF_CHECKSUM: ${XCF_CHECKSUM}"
- name: Create package files from templates
run: |
envsubst <templates/lwkFFI.podspec >lwkFFI.podspec
envsubst <templates/LiquidWalletKit.podspec >LiquidWalletKit.podspec
envsubst <templates/Package.swift >Package.swift
- name: Copy sources
run: |
cp build/target/swift/lwk.swift Sources/LiquidWalletKit/LiquidWalletKit.swift
- name: Tag the Swift bindings
run: |
git add Package.swift Sources lwkFFI.podspec LiquidWalletKit.podspec
git commit -m "Bump Liquid Wallet Kit to version ${VERSION}"
git tag ${VERSION} -m "${VERSION}"
git push
git push --tags
- name: Release and attach XCFramework binary artifact
uses: ncipollo/release-action@v1
with:
artifacts: "build/target/lwkFFI.xcframework.zip"
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ env.VERSION }}
prerelease: true
- name: Push update to Cocoapods trunk
env:
COCOAPODS_TRUNK_TOKEN: ${{secrets.COCOAPODS_TRUNK_TOKEN}}
run: |
pod trunk push lwkFFI.podspec --allow-warnings
pod trunk push LiquidWalletKit.podspec --allow-warnings --synchronous