Skip to content

0.4.0-alpha-6

0.4.0-alpha-6 #36

Workflow file for this run

name: Release
on:
workflow_dispatch:
release:
types: [created]
env:
CARGO_TERM_COLOR: always
TOOLCHAIN: nightly
CARGO_MAKE_TOOLCHAIN: nightly
jobs:
build-wasm:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
targets:
wasm32-unknown-unknown
- uses: taiki-e/install-action@v2
with:
tool: wasm-pack
- uses: taiki-e/install-action@v2
with:
tool: wasm-bindgen
- name: Builb wasm for nodesjs
working-directory: ./crates/wasm
run: ./build.sh nodejs
- name: Builb wasm for web
working-directory: ./crates/wasm
run: ./build.sh web
- uses: actions/upload-artifact@v4
with:
retention-days: 5
name: liveview-native-core-wasm-web
path: ./crates/wasm/liveview-native-core-wasm-web.tgz
- uses: actions/upload-artifact@v4
with:
retention-days: 5
name: liveview-native-core-wasm-nodejs
path: ./crates/wasm/liveview-native-core-wasm-nodejs.tgz
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
- uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
target
key: cargo-${{ github.workflow }}-${{ github.job }}-${{runner.os}}-${{runner.arch}}-${{ hashFiles('**/Cargo.toml') }}
- 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/
- uses: actions/download-artifact@v4
with:
name: liveview-native-core-wasm-web
path: ./crates/wasm/
- uses: actions/download-artifact@v4
with:
name: liveview-native-core-wasm-nodejs
path: ./crates/wasm/
- run: ls ./crates/wasm/ ./crates/wasm/*
- 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 -f ./crates/core/liveview-native-core-swift/Sources/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/*.swift
git commit -m "Update Package.swift and add generated LiveViewNativeCore.swift to tracking"
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
./crates/wasm/liveview-native-core-wasm-web.tgz
./crates/wasm/liveview-native-core-wasm-nodejs.tgz
draft: true
prerelease: true
tag_name: ${{ github.event.release.tag_name }}