-
Notifications
You must be signed in to change notification settings - Fork 4
86 lines (69 loc) · 2.58 KB
/
maven-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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build
on:
pull_request:
branches: [ "main" ]
# Default to bash
defaults:
run:
shell: bash
jobs:
build-main:
permissions:
contents: write
packages: write
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
steps:
- name: Install gcc-multilib
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Set up Maven settings.xml on ${{ matrix.os }}
uses: s4u/[email protected]
with:
repositories: '[{"id":"github","name":"MetricsHub JRE Builder","url":"https://maven.pkg.github.com/sentrysoftware/metricshub-jre-builder","snapshots":{"enabled":true},"releases":{"enabled":true}}]'
sonatypeSnapshots: true
- name: Build with Maven on ${{ matrix.os }}
run: mvn -B -U verify --file pom.xml
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Get version
run: |
metricshub_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "MetricsHub version ${metricshub_version}"
echo "metricshub_version=$metricshub_version" >> $GITHUB_ENV
- name: Upload Linux Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: metricshub-linux-package-${{ env.metricshub_version }}
path: ./metricshub-linux/target/metricshub-linux-${{ env.metricshub_version }}.tar.gz
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'windows-latest' }}
with:
name: metricshub-windows-package-${{ env.metricshub_version }}
path: ./metricshub-windows/target/metricshub-windows-${{ env.metricshub_version }}.zip
- name: Upload Site Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: metricshub-site-${{ env.metricshub_version }}
path: ./metricshub-doc/target/metricshub-doc-${{ env.metricshub_version }}-site.jar
- name: Upload Docker Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: metricshub-docker-package-${{ env.metricshub_version }}
path: ./metricshub-linux/target/metricshub-linux-${{ env.metricshub_version }}-docker.tar.gz