Skip to content

Release

Release #11

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Tag in SemVer format'
required: true
type: string
jobs:
validation:
runs-on: ubuntu-latest
steps:
- name: Validate tag
run: |
echo "${{ github.event.inputs.version }}" | grep -P '^[0-9]+\.[0-9]+\.[0-9]+'
swift:
runs-on: macos-latest
needs: validation
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: "aarch64-apple-ios-sim,aarch64-apple-ios,x86_64-apple-ios"
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- uses: taiki-e/install-action@v2
with:
tool: cargo-swift
- name: Generate Swift package
run: cargo swift package -p ios -n WalletSdkRs --release
- name: Compress XCFramework
run: |
zip -9 -r RustFramework.xcframework.zip WalletSdkRs/RustFramework.xcframework
echo "XCF_CHECKSUM=`swift package compute-checksum RustFramework.xcframework.zip`" >> $GITHUB_ENV
- name: Update Swift Package definition
run: |
sed -i '' 's/.binaryTarget.*/.binaryTarget(name: "RustFramework", url: "https:\/\/github.com\/spruceid\/wallet-sdk-rs\/releases\/download\/${{ github.event.inputs.version }}\/RustFramework.xcframework.zip", checksum: "${{ env.XCF_CHECKSUM }}"),/' Package.swift
- name: Update Cocoapods definitions
run: |
sed -i '' -r 's/[0-9]+.[0-9]+.[0-9]+/poo/' SpruceIDWalletSdkRsRustFramework.podspec
sed -i '' -r 's/[0-9]+.[0-9]+.[0-9]+/poo/' SpruceIDWalletSdkRs.podspec
- name: Push changes and tag
run: |
git config user.name github-actions
git config user.email [email protected]
git add Package.swift SpruceIDWalletSdkRs.podspec SpruceIDWalletSdkRsRustFramework.podspec
git commit -m "Release ${{ github.event.inputs.version }}"
git push
git tag ${{ github.event.inputs.version }} -m "${{ github.event.inputs.version }}"
git push --tags
- name: Create release and attach XCFramework binary artifact
uses: ncipollo/release-action@v1
with:
artifacts: "RustFramework.xcframework.zip"
tag: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
# Using --quick otherwise pod lint will try to download SpruceIDWalletSdkRsRustFramework and it won't be available
# yet.
- name: Publish to CocoaPod register
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
pod trunk push SpruceIDWalletSdkRsRustFramework.podspec
pod trunk push SpruceIDWalletSdkRs.podspec --quick
kotlin:
runs-on: ubuntu-latest
needs: swift
defaults:
run:
working-directory: ./kotlin
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: "aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android"
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- uses: taiki-e/install-action@v2
with:
tool: cargo-ndk
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
build-root-directory: ./kotlin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}