-
-
Notifications
You must be signed in to change notification settings - Fork 6
120 lines (116 loc) · 4.71 KB
/
ci.yml
File metadata and controls
120 lines (116 loc) · 4.71 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
name: "CI"
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEFAULT_JAVA_VERSION: 25
DEFAULT_JAVA_DISTRIBUTION: 'microsoft'
jobs:
build:
name: Build for Java ${{ matrix.java }} on ${{ matrix.distribution }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java:
- 25
- 26
distribution:
- 'adopt-hotspot'
- 'oracle'
include:
- java: 25
distribution: 'microsoft'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
submodules: true
- name: 'Setup Java'
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- name: 'Setup Gradle'
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper
cache-read-only: false
- name: 'Mark tag as release'
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE=true" >> $GITHUB_ENV
- name: 'Unlock keystore'
id: unlock_keystore
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
if: ${{ env.KEYSTORE_BASE64 }}
uses: timheuer/base64-to-file@v1
with:
fileName: 'keystore.jks'
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: 'Expose keystore'
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
if: ${{ env.KEYSTORE_BASE64 }}
run: cp ${{ steps.unlock_keystore.outputs.filePath }} .
- name: 'Build'
run: ./gradlew build --no-daemon
env:
SIGN_KEYSTORE: ${{ secrets.SIGN_KEYSTORE }}
SIGN_ALIAS: ${{ secrets.SIGN_ALIAS }}
SIGN_KEYPASS: ${{ secrets.SIGN_KEYPASS }}
SIGN_STOREPASS: ${{ secrets.SIGN_STOREPASS }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_KEY: ${{ secrets.MAVEN_KEY }}
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Test'
run: ./gradlew test runGameTestServer jacocoTestReport
- name: 'Submit coverage results'
uses: coverallsapp/github-action@v2
with:
flag-name: ${{ matrix.java }}-${{ matrix.distribution }}
parallel: true
- name: 'Deploy as GitHub CI artifacts'
uses: actions/upload-artifact@v4
if: startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
with:
if-no-files-found: error
path: build/libs/*
- name: 'Deploy to CurseForge'
if: (startsWith(github.ref, 'refs/tags/') || (!startsWith(github.event.head_commit.message, 'Bump mod version') && startsWith(github.ref, 'refs/heads/master'))) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
env:
CURSEFORGE_KEY_SECRET: ${{ secrets.CURSEFORGE_KEY_SECRET }}
run: ./gradlew publishCurseForge
- name: 'Deploy to Modrinth'
continue-on-error: true
if: (startsWith(github.ref, 'refs/tags/') || (!startsWith(github.event.head_commit.message, 'Bump mod version') && startsWith(github.ref, 'refs/heads/master'))) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
env:
MODRINTH_KEY_SECRET: ${{ secrets.MODRINTH_KEY_SECRET }}
run: ./gradlew modrinth
- name: 'Deploy to Maven'
if: (startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/feature')) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_KEY: ${{ secrets.MAVEN_KEY }}
run: ./gradlew publish
- name: 'Deploy JavaDoc to GitHub Pages'
if: startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: build/docs/javadoc
clean: true
coveralls:
name: Coverage check
needs: build
runs-on: ubuntu-latest
steps:
- name: Consolidate test coverage from different jobs
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
fail-on-error: false