-
Notifications
You must be signed in to change notification settings - Fork 12
115 lines (98 loc) · 3.7 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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 -f ./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 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
draft: true
prerelease: true
tag_name: ${{ github.event.release.tag_name }}