-
Notifications
You must be signed in to change notification settings - Fork 13
65 lines (54 loc) · 1.97 KB
/
build.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
# TODO Add publishing to github Packages to speed up the distribution.
# https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven#publishing-packages-to-the-maven-central-repository-and-github-packages
name: Build OpenPnP Capture Java Distribution
on:
push:
pull_request:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
java: [8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Cache maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Build
run: |
./scripts/download-openpnp-capture.sh v0.0.28
mvn -B clean package
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
path: |
target/openpnp-capture-java-*.jar
- name: Create Release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
artifacts: "target/openpnp-capture-java*.jar"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
- name: Publish to Apache Maven Central
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: mvn -B deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}