1+ name : Release cordova extension package
2+
3+ on :
4+ push :
5+ tags :
6+ - cordova-*
7+
8+ env :
9+ RUST_LATEST_STABLE_VERSION : 1.67
10+
11+ jobs :
12+ initial_release :
13+ name : Publish cordova extension package
14+ runs-on : ubuntu-latest
15+ outputs :
16+ upload_url : ${{ steps.create_release.outputs.upload_url }}
17+ version : ${{ steps.get_version.outputs.version }}
18+ steps :
19+ - name : Checkout code
20+ uses : actions/checkout@v3
21+
22+ - name : Create Release
23+ id : create_release
24+ uses : actions/create-release@v1
25+ env :
26+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
27+ with :
28+ tag_name : ${{ github.ref }}
29+ release_name : Release ${{ github.ref }}
30+ draft : true
31+ prerelease : false
32+
33+ - name : Set version output
34+ id : get_version
35+ run : echo ::set-output name=version::``${GITHUB_REF#refs/tags/}``
36+
37+ build_uniffi :
38+ name : Build uniffi jni shared libs for android with cross
39+ runs-on : ubuntu-latest
40+ strategy :
41+ matrix :
42+ config :
43+ - { target: aarch64-linux-android }
44+ - { target: armv7-linux-androideabi }
45+ - { target: i686-linux-android }
46+ - { target: x86_64-linux-android }
47+
48+ steps :
49+ - name : Checkout code
50+ uses : actions/checkout@v1
51+ with :
52+ submodules : true
53+
54+ - name : Install rust toolchain
55+ uses : actions-rs/toolchain@v1
56+ with :
57+ toolchain : ${{env.RUST_LATEST_STABLE_VERSION}}
58+ override : true
59+ default : true
60+
61+ - name : Install cross
62+ run : cargo install cross
63+
64+ - name : Build library (release)
65+ env :
66+ RUSTFLAGS : " -C embed-bitcode"
67+ run : |
68+ cross rustc --release --target ${{ matrix.config.target }} -p wallet-uniffi --features builtin-bindgen -- -C lto
69+
70+ - name : Prepare package
71+ run : mkdir -p jniLibs/${{ matrix.config.target }}
72+
73+ - name : copy binary
74+ run : cp ./target/${{ matrix.config.target }}/release/libuniffi_jormungandr_wallet.so ./jniLibs/${{ matrix.config.target }}/;
75+
76+ - uses : actions/upload-artifact@v2
77+ with :
78+ name : jniLibs
79+ path : ./jniLibs
80+ retention-days : 1
81+
82+ build_lipo_asset :
83+ name : Build universal lib for cordova plugin
84+ runs-on : macos-latest
85+ strategy :
86+ fail-fast : false
87+
88+ steps :
89+ - uses : actions-rs/toolchain@v1
90+ with :
91+ toolchain : ${{env.RUST_LATEST_STABLE_VERSION}}
92+ override : true
93+ default : true
94+
95+ - run : rustup target add x86_64-apple-ios
96+ - run : rustup target add aarch64-apple-ios
97+
98+ - name : Checkout code
99+ uses : actions/checkout@v1
100+ with :
101+ submodules : true
102+
103+ - name : build universal lib
104+ env :
105+ RUSTFLAGS : " -C embed-bitcode"
106+ working-directory : ./src/chain-wallet-libs/bindings/wallet-cordova/scripts
107+ run : python3 ./build_ios.py
108+
109+ - uses : actions/upload-artifact@v1
110+ with :
111+ name : iosLibs
112+ path : ./src/chain-wallet-libs/bindings/wallet-cordova/src/ios
113+
114+ package_cordova_plugin :
115+ runs-on : ubuntu-latest
116+ needs : [build_uniffi, build_lipo_asset]
117+
118+ steps :
119+ - name : Checkout code
120+ uses : actions/checkout@v1
121+ with :
122+ submodules : true
123+
124+ - name : Download jni libs
125+ uses : actions/download-artifact@v1
126+ with :
127+ name : jniLibs
128+
129+ - name : make libs directory
130+ run : mkdir -p src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
131+
132+ - name : Copy libs
133+ run : cp -r jniLibs/* src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
134+
135+ - name : rename arm64-v8a
136+ working-directory : ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
137+ run : mv aarch64-linux-android arm64-v8a
138+
139+ - name : rename armv7-linux-androideabi
140+ working-directory : ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
141+ run : mv armv7-linux-androideabi armeabi-v7a
142+
143+ - name : rename i686-linux-android
144+ working-directory : ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
145+ run : mv i686-linux-android x86
146+
147+ - name : rename x86_64
148+ working-directory : ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
149+ run : mv x86_64-linux-android x86_64
150+
151+ - name : Install uniffi
152+ uses :
actions-rs/[email protected] 153+ with :
154+ crate : uniffi_bindgen
155+ version : 0.21.1
156+ use-tool-cache : true
157+
158+ - name : copy java definitions from jni
159+ run : python3 ./src/chain-wallet-libs/bindings/wallet-cordova/scripts/copy_jni_definitions.py
160+
161+ - name : Download artifact with universal lib
162+ uses : actions/download-artifact@v1
163+ with :
164+ name : iosLibs
165+
166+ - name : Copy universal lib to plugin's directory
167+ run : cp -r iosLibs/* src/chain-wallet-libs/bindings/wallet-cordova/src/ios
168+
169+ - name : setup node
170+ uses : actions/setup-node@v1
171+ with :
172+ node-version : 12.x
173+
174+ - name : package module
175+ run : npm pack ./src/chain-wallet-libs/bindings/wallet-cordova
176+
177+ - name : rename-tarball
178+ run : |
179+ find . \
180+ -name wallet-cordova-plugin*.tgz \
181+ -exec mv {} chain-wallet-libs-${{ needs.initial_release.outputs.version }}-cordova.tgz \;
182+
183+ - name : Upload binaries to release
184+ uses : actions/upload-release-asset@v1
185+ env :
186+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
187+ with :
188+ upload_url : ${{ needs.initial_release.outputs.upload_url }}
189+ asset_path : ./chain-wallet-libs-${{ needs.initial_release.outputs.version }}-cordova.tgz
190+ asset_name : chain-wallet-libs-cordova-${{ needs.initial_release.outputs.version }}
191+ asset_content_type : application/gzip
0 commit comments