Skip to content

Release

Release #17

Workflow file for this run

name: Release
on:
workflow_dispatch:
release:
types: [created]
push:
branches:
- simlay/release-ci-for-swift-and-kotlin
env:
CARGO_TERM_COLOR: always
TOOLCHAIN: nightly
CARGO_MAKE_TOOLCHAIN: nightly
jobs:
build-xcframework:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
components: rust-src
targets:
aarch64-apple-ios-sim
aarch64-apple-ios
x86_64-apple-ios
aarch64-apple-darwin
x86_64-apple-darwin
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
target
key: ${{ github.workflow }}-${{ github.job }}-toolchain-${{ env.TOOLCHAIN }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-make
- name: Build XCFramework
run: |
cargo make --profile release uniffi-xcframework
ditto -c -k --sequesterRsrc --keepParent target/uniffi/swift/liveview_native_core.xcframework/ target/uniffi/swift/liveview_native_core.xcframework.zip
- uses: actions/upload-artifact@v4
with:
retention-days: 5
name: liveview_native_core.xcframework.zip
path: ./target/uniffi/swift/liveview_native_core.xcframework.zip
tag-release:
runs-on: macos-14
permissions:
contents: write
needs:
- build-xcframework
steps:
- uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-make
- name: Build XCFramework
run: |
cargo make --profile release uniffi-swift-package
- uses: actions/download-artifact@v4
with:
name: liveview_native_core.xcframework.zip
path: ./target/uniffi/swift/
- name: Update version and checksum of xcframework in Package.swift
run: |
ls -lah ./target/uniffi/swift/
checksum=$(swift package compute-checksum ./target/uniffi/swift/liveview_native_core.xcframework.zip)
version=${{ github.event.release.tag_name }}
sed -i "" -E "s/(let releaseTag = \")[^\"]+(\")/\1$version\2/g" Package.swift
sed -i "" -E "s/(let releaseChecksum = \")[^\"]+(\")/\1$checksum\2/g" Package.swift
sed -i "" -E "s/let useLocalFramework = true/let useLocalFramework = false/g" Package.swift
git add Package.swift
git add ./crates/core/liveview-native-core-swift/Sources/LiveViewNativeCore/LiveViewNativeCore.swift
git diff --staged
- name: Commit, tag and push swift package
if: github.event_name == 'release'
run: |
git add Package.swift
git add ./crates/core/liveview-native-core-swift/Sources/LiveViewNativeCore/LiveViewNativeCore.swift
git tag -fa ${{ github.event.release.tag_name }} -m "Swift Package Release ${{ github.event.release.tag_name }}"
git push origin ${{ github.event.release.tag_name }} --force
- name: Release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: ./target/uniffi/swift/liveview_native_core.xcframework.zip
draft: true
prerelease: true
tag_name: ${{ github.event.release.tag_name }}