Update release actions and use zip for xcframework #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: xcframework-release | |
on: | |
- workflow_dispatch | |
- push | |
env: | |
CARGO_TERM_COLOR: always | |
TOOLCHAIN: nightly | |
CARGO_MAKE_TOOLCHAIN: nightly | |
jobs: | |
release-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 | |
path: ./target/uniffi/swift/liveview_native_core.xcframework.zip | |
- uses: actions/github-script@v7 | |
if: github.ref == 'refs/heads/main' | |
continue-on-error: true | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
let release | |
try { | |
release = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag: 'nightly' | |
}) | |
} catch(e) { | |
console.error(e) | |
return | |
} | |
await github.rest.repos.deleteRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: release.data.id | |
}) | |
await github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'tags/nightly' | |
}) | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: github.ref == 'refs/heads/main' | |
with: | |
files: liveview_native_core.xcframework.zip | |
name: nightly | |
tag_name: nightly |