-
Notifications
You must be signed in to change notification settings - Fork 11
188 lines (159 loc) · 6.57 KB
/
publish-on-maven.yml
File metadata and controls
188 lines (159 loc) · 6.57 KB
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
name: Publish to Maven Central
on:
release:
types: [published]
jobs:
build-rust-macos-aarch64:
if: startsWith(github.event.release.tag_name, 'v')
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust library
working-directory: wrywebview
run: cargo build --release --target aarch64-apple-darwin
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: native-darwin-aarch64
path: wrywebview/target/aarch64-apple-darwin/release/libcomposewebview_wry.dylib
retention-days: 1
build-rust-macos-x86_64:
if: startsWith(github.event.release.tag_name, 'v')
runs-on: macos-15-intel
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust library
working-directory: wrywebview
run: cargo build --release --target x86_64-apple-darwin
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: native-darwin-x86_64
path: wrywebview/target/x86_64-apple-darwin/release/libcomposewebview_wry.dylib
retention-days: 1
build-rust-linux:
if: startsWith(github.event.release.tag_name, 'v')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libxdo-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust library
working-directory: wrywebview
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: native-linux-x86_64
path: wrywebview/target/x86_64-unknown-linux-gnu/release/libcomposewebview_wry.so
retention-days: 1
build-rust-windows:
if: startsWith(github.event.release.tag_name, 'v')
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust library
working-directory: wrywebview
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: native-windows-x86_64
path: wrywebview/target/x86_64-pc-windows-msvc/release/composewebview_wry.dll
retention-days: 1
publish:
if: startsWith(github.event.release.tag_name, 'v')
needs:
- build-rust-macos-aarch64
- build-rust-macos-x86_64
- build-rust-linux
- build-rust-windows
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set version from tag
shell: bash
run: |
TAG="${{ github.event.release.tag_name }}"
VERSION_NAME="${TAG#v}"
echo "VERSION_NAME=$VERSION_NAME" >> "$GITHUB_ENV"
sed -i.bak "s/^VERSION_NAME=.*/VERSION_NAME=$VERSION_NAME/" gradle.properties
rm -f gradle.properties.bak
- name: Download macOS aarch64 native library
uses: actions/download-artifact@v4
with:
name: native-darwin-aarch64
path: wrywebview/target/aarch64-apple-darwin/release/
- name: Download macOS x86_64 native library
uses: actions/download-artifact@v4
with:
name: native-darwin-x86_64
path: wrywebview/target/x86_64-apple-darwin/release/
- name: Download Linux native library
uses: actions/download-artifact@v4
with:
name: native-linux-x86_64
path: wrywebview/target/x86_64-unknown-linux-gnu/release/
- name: Download Windows native library
uses: actions/download-artifact@v4
with:
name: native-windows-x86_64
path: wrywebview/target/x86_64-pc-windows-msvc/release/
- name: Prepare JVM native resources
run: |
mkdir -p wrywebview/src/jvmMain/resources/darwin-aarch64
mkdir -p wrywebview/src/jvmMain/resources/darwin-x86-64
mkdir -p wrywebview/src/jvmMain/resources/linux-x86-64
mkdir -p wrywebview/src/jvmMain/resources/win32-x86-64
cp wrywebview/target/aarch64-apple-darwin/release/libcomposewebview_wry.dylib \
wrywebview/src/jvmMain/resources/darwin-aarch64/
cp wrywebview/target/x86_64-apple-darwin/release/libcomposewebview_wry.dylib \
wrywebview/src/jvmMain/resources/darwin-x86-64/
cp wrywebview/target/x86_64-unknown-linux-gnu/release/libcomposewebview_wry.so \
wrywebview/src/jvmMain/resources/linux-x86-64/
cp wrywebview/target/x86_64-pc-windows-msvc/release/composewebview_wry.dll \
wrywebview/src/jvmMain/resources/win32-x86-64/
- name: Verify native libraries
run: |
echo "=== Native libraries downloaded ==="
ls -la wrywebview/target/aarch64-apple-darwin/release/
ls -la wrywebview/target/x86_64-apple-darwin/release/
ls -la wrywebview/target/x86_64-unknown-linux-gnu/release/
ls -la wrywebview/target/x86_64-pc-windows-msvc/release/
echo "=== Native libraries in resources ==="
ls -la wrywebview/src/jvmMain/resources/darwin-aarch64/
ls -la wrywebview/src/jvmMain/resources/darwin-x86-64/
ls -la wrywebview/src/jvmMain/resources/linux-x86-64/
ls -la wrywebview/src/jvmMain/resources/win32-x86-64/
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup Rust (for UniFFI bindgen)
uses: dtolnay/rust-toolchain@stable
- name: Publish to Maven Central
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVENCENTRALUSERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVENCENTRALPASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNINGINMEMORYKEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNINGKEYID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNINGPASSWORD }}