-
Notifications
You must be signed in to change notification settings - Fork 74
95 lines (82 loc) · 2.87 KB
/
java-bindings.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
name: Java Bindings
on:
push:
branches: [ main ]
tags: [ v** ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
ci_checks:
name: Build checks
uses: ./.github/workflows/ci-checks.yml
build:
name: Build Java bindings
needs: ci_checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache build dependencies
uses: actions/cache@v4
env:
cache-name: makefile-deps
with:
path: ~/.cache/fabric-protos
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Makefile') }}
${{ runner.os }}-${{ env.cache-name }}-
- name: Set up Java for publishing to GitHub Packages
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.6
cache: false
- name: Run make
run: make javabindings
- name: Set prerelease version
run: mvn --batch-mode versions:set -DnewVersion=${BINDING_VERSION}-dev-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}
if: needs.ci_checks.outputs.publish_release != 'true'
working-directory: bindings/java
env:
BINDING_VERSION: ${{ needs.ci_checks.outputs.binding_version }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
- name: Set release version
run: mvn --batch-mode versions:set -DnewVersion=${BINDING_VERSION}
if: needs.ci_checks.outputs.publish_release == 'true'
working-directory: bindings/java
env:
BINDING_VERSION: ${{ needs.ci_checks.outputs.binding_version }}
- name: Publish to GitHub Packages
continue-on-error: true
run: mvn -P github --batch-mode deploy
if: github.event_name != 'pull_request'
working-directory: bindings/java
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v4
if: needs.ci_checks.outputs.publish_release == 'true'
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: mvn -P ossrh --batch-mode deploy
if: needs.ci_checks.outputs.publish_release == 'true'
working-directory: bindings/java
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}