forked from pcodec/pcodec
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (112 loc) · 3.92 KB
/
Copy pathjava_publish.yml
File metadata and controls
118 lines (112 loc) · 3.92 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
name: Java Publish
on:
release:
types:
- published
env:
GROUP_ID: io/github/pcodec
jobs:
linux:
strategy:
matrix:
target: [ x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu ]
include:
- target: x86_64-unknown-linux-gnu
jni_target: linux-x86-64
- target: aarch64-unknown-linux-gnu
jni_target: linux-aarch64
runs-on: ubuntu-latest
if: contains(github.event.release.name, 'Java')
steps:
- uses: actions/checkout@v4
- name: Cargo Config
run: mv .cargo/config_for_publishing.toml .cargo/config.toml
- name: Set Rust version
run: rustup override set nightly
# it seems that rust targets don't work out of the box on linux,
# so use cross (which uses docker) instead
- name: Cross compilation tools
run: cargo install cross
- name: Build target dylibs
run: cross build --release -p pco_java --target "${{ matrix.target }}"
- name: Upload dynamic lib
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.jni_target }}
path: target/${{ matrix.target }}/release/libpco_java.so
mac:
strategy:
matrix:
target: [ aarch64-apple-darwin, x86_64-apple-darwin ]
include:
- target: aarch64-apple-darwin
jni_target: darwin-aarch64
- target: x86_64-apple-darwin
jni_target: darwin-x86-64
runs-on: macos-latest
if: contains(github.event.release.name, 'Java')
steps:
- uses: actions/checkout@v4
- name: Cargo Config
run: mv .cargo/config_for_publishing.toml .cargo/config.toml
- name: Set Rust version
run: rustup override set nightly
- name: Add rustup target
run: rustup target add "${{ matrix.target }}"
- name: Build target dylibs
run: cargo build --release -p pco_java --target "${{ matrix.target }}"
- name: Upload dynamic lib
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.jni_target }}
path: target/${{ matrix.target }}/release/libpco_java.dylib
windows:
strategy:
matrix:
target: [ x86_64-pc-windows-msvc ]
include:
- target: x86_64-pc-windows-msvc
jni_target: win32-x86-64
runs-on: windows-latest
if: contains(github.event.release.name, 'Java')
steps:
- uses: actions/checkout@v4
- name: Cargo Config
run: mv -Force .cargo/config_for_publishing.toml .cargo/config.toml
- name: Set Rust version
run: rustup override set nightly
- name: Add rustup target
run: rustup target add "${{ matrix.target }}"
- name: Build target dylibs
run: cargo build --release -p pco_java --target "${{ matrix.target }}"
- name: Upload dynamic lib
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.jni_target }}
path: target/${{ matrix.target }}/release/pco_java.dll
publish:
runs-on: ubuntu-latest
needs: [ linux, mac, windows ]
if: contains(github.event.release.name, 'Java')
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Download dylibs to resources
uses: actions/download-artifact@v4
with:
path: pco_java/src/main/resources/${{ env.GROUP_ID }}
- name: Publish package
run: cd pco_java && mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}