-
Notifications
You must be signed in to change notification settings - Fork 42
113 lines (101 loc) · 3.09 KB
/
java.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
name: Build and publish Java artifact
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11.0, ubuntu-20.04, windows-2019]
include:
- os: macos-11.0
ARCH: macos-x86_64
FILE: 'libminify_html_java.dylib'
- os: ubuntu-20.04
ARCH: linux-x86_64
FILE: 'libminify_html_java.so'
- os: windows-2019
ARCH: windows-x86_64
FILE: 'minify_html_java.dll'
steps:
- uses: actions/checkout@v1
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build Java native library
run: cargo build --release
working-directory: ./minify-html-java
- name: Upload built library
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.ARCH }}
path: ./target/release/${{ matrix.FILE }}
package:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '1.7'
java-package: jdk
architecture: x64
- name: Download Linux built library
uses: actions/download-artifact@v1
with:
name: linux-x86_64
path: minify-html-java/src/main/resources/linux-x86_64
- name: Download macOS built library
uses: actions/download-artifact@v1
with:
name: macos-x86_64
path: minify-html-java/src/main/resources/macos-x86_64
- name: Download Windows built library
uses: actions/download-artifact@v1
with:
name: windows-x86_64
path: minify-html-java/src/main/resources/windows-x86_64
- name: Move native library files to correct location
shell: bash
working-directory: ./minify-html-java/src/main/resources
run: |
for f in *; do
mv $f/* "$f.nativelib"
rmdir "$f"
done
- name: Build, pack, and publish JAR
working-directory: ./minify-html-java
env:
SONATYPE_GPG_PRIVATE_KEY: ${{ secrets.SONATYPE_GPG_PRIVATE_KEY }}
run: |
echo "$SONATYPE_GPG_PRIVATE_KEY" | gpg --allow-secret-key-import --import
mkdir -p "$HOME/.m2"
cat << 'EOF' > "$HOME/.m2/settings.xml"
<settings>
<servers>
<server>
<id>ossrh</id>
<username>wilsonzlin</username>
<password>${{ secrets.SONATYPE_PASSWORD }}</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
</settings>
EOF
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
mvn clean deploy
fi