-
Notifications
You must be signed in to change notification settings - Fork 3
214 lines (185 loc) · 6.76 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
# Workflow for release a jar file with all native dependencies embedded.
# The Workflow also releases a AAR file with the native dependencies build for Android.
# The workflow runs whenever a release is published.
name: Release
on:
workflow_dispatch: # allow manual trigger
env:
dummy: 2 # change to force cache invalidation
CARGO_TERM_COLOR: always # implicitly adds '--color=always' to all cargo commands
jobs:
build-native-ubuntu:
runs-on: ubuntu-22.04
steps:
# Setup rust
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.69
# Checkout the code
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Make ubuntu native dependencies
run: make
- name: Upload linux library
uses: actions/upload-artifact@master
with:
name: ubuntu-library
path: ./concordium-sdk/native/libcrypto_jni.so
build-native-macos:
runs-on: macos-latest
steps:
# Setup rust
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.69
# Checkout the code
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Make macos native dependencies
run: make
- name: Upload macos library
uses: actions/upload-artifact@master
with:
name: macos-library
path: ./concordium-sdk/native/libcrypto_jni.dylib
build-native-windows:
runs-on: windows-latest
steps:
# Setup rust
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.69
# Checkout the code
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Make windows native dependencies
run: cd crypto-jni && cargo build --release
- name: Upload windows library
uses: actions/upload-artifact@master
with:
name: windows-library
path: crypto-jni\target\release\crypto_jni.dll
build-native-android:
runs-on: ubuntu-22.04
steps:
- name: Set Up Android tools
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager \
--sdk_root=$ANDROID_SDK_ROOT \
"platform-tools" "platforms;android-29" "build-tools;29.0.2"
# Setup rust
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.69
# Checkout the code
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Make android native dependencies
run: make add-android-targets && make android
- name: Upload android
uses: actions/upload-artifact@master
with:
name: android-library
path: ./concordium-android-sdk/native
build-and-release-jar:
needs: [build-native-ubuntu, build-native-macos, build-native-windows, build-native-android]
# Use fixed OS version because we install packages on the system.
runs-on: ubuntu-22.04
environment: release
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set Up Android tools
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager \
--sdk_root=$ANDROID_SDK_ROOT \
"platform-tools" "platforms;android-29" "build-tools;29.0.2"
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'adopt'
cache: maven
- name: Download linux library
uses: actions/download-artifact@master
with:
name: ubuntu-library
path: concordium-sdk/native
- name: Download macos library
uses: actions/download-artifact@master
with:
name: macos-library
path: concordium-sdk/native
- name: Download windows library
uses: actions/download-artifact@master
with:
name: windows-library
path: concordium-sdk/native
- name: Download android library
uses: actions/download-artifact@master
with:
name: android-library
path: ./concordium-android-sdk/native
# Builds and tests the sdk. Delomboks code and generates a javadoc jar from the delombok'ed code
- name: Build and test sdk
run: cd concordium-sdk && mvn --batch-mode --update-snapshots install -Pwith-dependencies && mvn lombok:delombok -f pom.xml && mvn javadoc:jar -f pom.xml && mvn source:jar
- name: Deploy javadoc
uses: MathieuSoysal/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
javadoc-branch: javadoc
java-version: 8
target-folder: javadoc # url will be https://concordium.github.io/concordium-java-sdk/javadoc/concordium-sdk/apidocs/
subdirectories: ./concordium-sdk
without-checkout: true
project: maven
custom-command: cd concordium-sdk && mvn javadoc:javadoc -f pom.xml # Generates javadoc from the delombok'ed code
- name: Release github
uses: softprops/action-gh-release@v1
with:
files: |
concordium-sdk/target/*-with-dependencies.jar
concordium-sdk/target/*-javadoc.jar
concordium-sdk/target/*-sources.jar
- name: Setup and maven central
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: 'adopt'
java-version: '8'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.SONATYPE_PKEY }} # Value of the GPG private key to import
gpg-passphrase: GPG_PASSPHRASE # Passphrase for the GPG private key
- name: Publish java package to central maven repository
run: cd concordium-sdk && mvn --batch-mode deploy -Pdeploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USR }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PWD }}
GPG_PASSPHRASE: ${{secrets.SONATYPE_PHRASE }}
- name: Copy javadocs and sources for android
run: >
mkdir -p concordium-android-sdk/target
&& mv concordium-sdk/target/*-javadoc.jar concordium-android-sdk/target/concordium-android-sdk-javadoc.jar
&& mv concordium-sdk/target/*-sources.jar concordium-android-sdk/target/concordium-android-sdk-sources.jar
- name: Publish android package to central maven repository
run: cd concordium-android-sdk && mvn --batch-mode deploy -Pdeploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USR }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PWD }}
GPG_PASSPHRASE: ${{secrets.SONATYPE_PHRASE }}