-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.3 KB
/
ci-cd.yml
File metadata and controls
52 lines (49 loc) · 1.3 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
name: Java CI/CD
on:
push:
tags:
- '*'
pull_request:
branches:
- '**'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: maven
- name: Install quakestat
run: sudo apt-get update && sudo apt-get install -y quakestat
- name: Set version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "REVISION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "REVISION=0.0.0-SNAPSHOT" >> $GITHUB_ENV
fi
- name: Build with Maven
run: mvn -B package -Drevision=${{ env.REVISION }} --file pom.xml
publish:
if: startsWith(github.ref, 'refs/tags/')
needs: build-and-test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
server-id: github
- name: Publish to GitHub Packages
run: mvn -B deploy -DskipTests -Drevision=${{ github.ref_name }} --file pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}