forked from hyperledger/anoncreds-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (198 loc) · 7.34 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
name: "Release Libraries"
env:
RUST_VERSION: "1.73.0"
CROSS_VERSION: "0.2.4"
on:
workflow_dispatch:
inputs:
tag:
description: 'Create release with tag'
required: true
type: string
jobs:
build-swift-package:
name: Build Swift Package
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
save-if: false
- name: Build library for macOS
if: "runner.os == 'macOS'"
run: |
cd uniffi
echo "TAG: ${{github.event.inputs.tag}}"
./build-release-apple-universal.sh
cd ..
checksum=$(swift package compute-checksum 'uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip')
echo "CHECKSUM: $checksum"
rm -f Package.swift
./.scripts/updatePackage.swift ${{github.event.inputs.tag}} $checksum './.scripts/TemplatePackage.swift' 'Package.swift'
- name: Commit package
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: prepare release ${{github.event.inputs.tag}}"
tagging_message: ${{github.event.inputs.tag}}
- name: Upload library artifacts
uses: actions/upload-artifact@v3
with:
name: libanoncreds.xcframework.zip
path: 'uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip'
- name: Create library artifacts directory
run: |
mkdir release-artifacts
cp 'uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip' release-artifacts/
- name: Add swift package artifacts to release
uses: svenstaro/upload-release-action@v2
with:
tag: ${{github.event.inputs.tag}}
file: uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip
asset_name: "libanoncreds.xcframework.zip"
build-kmp:
name: "Build KMP"
runs-on: macos-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
fetch-depth: 0
- name: "Install Java ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: zulu
- name: Install Homebrew
run: >
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: "Install autoconf, automake, libtool"
run: |
brew install autoconf automake libtool
- name: "Install Mac ToolChain"
run: |
brew tap messense/macos-cross-toolchains
- name: "Install Linux GNU for x86_64"
run: |
rm '/usr/local/bin/2to3'
rm '/usr/local/bin/2to3-3.11'
rm '/usr/local/bin/2to3-3.12'
rm '/usr/local/bin/python3'
rm '/usr/local/bin/python3.11'
rm '/usr/local/bin/python3.12'
rm '/usr/local/bin/idle3'
rm '/usr/local/bin/idle3.11'
rm '/usr/local/bin/idle3.12'
rm '/usr/local/bin/pydoc3'
rm '/usr/local/bin/pydoc3.11'
rm '/usr/local/bin/pydoc3.12'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/python3.11-config'
rm '/usr/local/bin/python3.12-config'
rm -r '/usr/local/lib/node_modules'
brew install --overwrite x86_64-unknown-linux-gnu
- name: "Install Linux GNU for aarch64"
run: |
brew install --overwrite aarch64-unknown-linux-gnu
- name: "Install Rust Targets"
run: |
rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
rustup target add aarch64-linux-android
rustup target add x86_64-linux-android
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-gnu
- name: "Install Rust Cargo NDK"
run: |
cargo install cargo-ndk
- name: "Publish to GitHub Maven"
working-directory: ./anoncred-kmm
run: |
./gradlew :anoncreds-kmp:publishAllPublicationsToGitHubPackagesRepository
build-release:
needs: [build-swift-package, build-kmp]
name: Build Library
strategy:
matrix:
include:
- architecture: linux-aarch64
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
lib: libanoncreds_uniffi.so
libPath: uniffi/target/aarch64-unknown-linux-gnu/release/libanoncreds_uniffi.so
use_cross: true
- architecture: linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
lib: libanoncreds_uniffi.so
libPath: uniffi/target/x86_64-unknown-linux-gnu/release/libanoncreds_uniffi.so
use_cross: true
- architecture: darwin-x86_64
os: macos-latest
target: x86_64-apple-darwin
lib: libanoncreds_uniffi.dylib
libPath: uniffi/target/x86_64-apple-darwin/release/libanoncreds_uniffi.dylib
- architecture: darwin-aarch64
os: macos-latest
target: aarch64-apple-darwin
lib: libanoncreds_uniffi.dylib
libPath: uniffi/target/aarch64-apple-darwin/release/libanoncreds_uniffi.dylib
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.target }}
- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
save-if: false
- name: Build library for Linux
if: "runner.os == 'Linux'"
run: |
cd uniffi
if [ -n "${{ matrix.use_cross }}" ]; then
cargo install --git https://github.com/cross-rs/cross --tag v${{ env.CROSS_VERSION }} cross
cross build --release --target ${{matrix.target}}
else
cargo build --release --target ${{matrix.target}}
fi
- name: Build library for macOS
if: "runner.os == 'macOS'"
run: |
cd uniffi
cargo build --release --target ${{matrix.target}}
- name: Upload library artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.lib }}
path: ${{ matrix.libPath }}
- name: Create library artifacts directory
run: |
mkdir release-artifacts
cp ${{ matrix.libPath }} release-artifacts/
- name: Release artifacts
uses: a7ul/[email protected]
with:
command: c
cwd: release-artifacts
files: .
outPath: "library-${{ matrix.architecture }}.tar.gz"
- name: Add library artifacts to release
uses: svenstaro/upload-release-action@v2
with:
tag: ${{github.event.inputs.tag}}
file: library-${{ matrix.architecture }}.tar.gz
asset_name: "library-${{ matrix.architecture }}-${{ github.sha }}.tar.gz"