Skip to content

Publish Swift Bindings #16

Publish Swift Bindings

Publish Swift Bindings #16

name: Publish Swift Bindings
on:
workflow_dispatch:
inputs:
version:
description: 'smartvaults-sdk repo release (MAJOR.MINOR.PATCH)'
required: true
type: string
jobs:
build-tag-release:
name: Build, tag, and release the Coinstr SDK Swift bindings
runs-on: macOS-latest
permissions:
contents: write
steps:
- name: Checkout smartvaults repo
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/smartvaults
path: build
ref: v${{ inputs.version }}
- name: Checkout smartvaults-sdk-swift repo
uses: actions/checkout@v3
with:
path: dist
ssh-key: ${{ secrets.REPO_SSH_KEY }}
- name: Build Swift bindings
working-directory: build/bindings/smartvaults-sdk-ffi
run: |
make init
make bindings-swift
- name: Compress XCFramework
working-directory: build/bindings/smartvaults-sdk-ffi/bindings-swift
run: |
zip -9 -r smartvaults_sdkFFI.xcframework.zip smartvaults_sdkFFI.xcframework
echo "XCF_CHECKSUM=`swift package compute-checksum smartvaults_sdkFFI.xcframework.zip`" >> $GITHUB_ENV
- name: Update Swift Package definition
working-directory: build/bindings/smartvaults-sdk-ffi/bindings-swift
run: |
sed 's#.binaryTarget(name: "smartvaults_sdkFFI", path: "./smartvaults_sdkFFI.xcframework"),#.binaryTarget(name: "smartvaults_sdkFFI", url: "https://github.com/smartvaults/smartvaults-sdk-swift/releases/download/${{ inputs.version }}/smartvaults_sdkFFI.xcframework.zip", checksum: "${{ env.XCF_CHECKSUM }}"),#;/.testTarget(name: "SmartVaultsSDKTests", dependencies: \["SmartVaultsSDK"\]),/d' Package.swift > ../../../../dist/Package.swift
cp -r Sources ../../../../dist
- name: Tag the Swift bindings
working-directory: dist
run: |
git config user.name github-actions
git config user.email [email protected]
git add Package.swift
git add Sources
git commit -m "Update SmartVaults SDK Swift bindings to version ${{ inputs.version }}"
git push
git tag ${{ inputs.version }} -m "${{ inputs.version }}"
git push --tags
- name: Release and attach XCFramework binary artifact
uses: ncipollo/release-action@v1
with:
artifacts: "build/bindings/smartvaults-sdk-ffi/bindings-swift/smartvaults_sdkFFI.xcframework.zip"
tag: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ inputs.version }}
prerelease: true