-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (105 loc) · 3.33 KB
/
maven.yml
File metadata and controls
110 lines (105 loc) · 3.33 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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build-spigot:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 8, 17, 21 ]
name: Build Spigot (JDK ${{ matrix.java-version }})
steps:
- uses: actions/checkout@v4
- name: Setup JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: "temurin"
cache: maven
- name: Build Spigot (JDK 8)
if: matrix.java-version == 8
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: 1.16.5, 1.16.3, 1.16.1, 1.15.2, 1.14.4, 1.13.2, 1.13, 1.12.2
remapped: true
- name: Build Spigot (JDK 17)
if: matrix.java-version == 17
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: 1.20.1, 1.19, 1.18.2, 1.18.1, 1.17.1
remapped: true
- name: Build Spigot (JDK 21)
if: matrix.java-version == 21
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: 1.21, 1.20.6, 1.20.4, 1.20.2
remapped: true
- name: Archive Maven Repository
run: tar -czf maven-repo-${{ matrix.java-version }}.tar.gz -C ~/.m2/repository .
- name: Upload Maven Repository
uses: actions/upload-artifact@v4
with:
name: maven-repo-${{ matrix.java-version }}
path: maven-repo-${{ matrix.java-version }}.tar.gz
build-maven:
runs-on: ubuntu-latest
needs: build-spigot
name: Build
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "temurin"
cache: maven
- name: Download Maven Repositories (JDK 8)
uses: actions/download-artifact@v4
with:
name: maven-repo-8
path: ~/
- name: Download Maven Repositories (JDK 17)
uses: actions/download-artifact@v4
with:
name: maven-repo-17
path: ~/
- name: Download Maven Repositories (JDK 21)
uses: actions/download-artifact@v4
with:
name: maven-repo-21
path: ~/
- name: Display structure of home
run: ls -R ~/
- name: Extract Maven Repositories
run: |
mkdir -p ~/.m2/repository
tar -xzf ~/maven-repo-8.tar.gz -C ~/.m2/repository/
tar -xzf ~/maven-repo-17.tar.gz -C ~/.m2/repository/
tar -xzf ~/maven-repo-21.tar.gz -C ~/.m2/repository/
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Cache Maven
id: cache-primes
uses: actions/cache@v4
if: always()
with:
path: |
~/.m2
~/repository
key: ${{ github.job }}-${{ hashFiles('**/pom.xml') }}
- name: Delete Maven Artifacts
uses: geekyeggo/delete-artifact@v5
if: always()
with:
name: |
maven-repo-*
failOnError: false