-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.13 KB
/
ci.yaml
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
name: CI/CD Spring Test Initializers
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15.4-alpine3.18
env:
POSTGRES_USER: ci-user
POSTGRES_PASSWORD: ci-pass
POSTGRES_DB: testsupport
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Set up Maven cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Wait for PostgreSQL to start
run: sleep 10
- name: Check PostgreSQL availability
run: ping -c 1 -W 5 postgres >/dev/null || { echo "Server is not reachable."; exit 1; }
- name: Build
run: mvn -B -ntp clean install
env:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_USER: ci-user
POSTGRES_PASSWORD: ci-pass
POSTGRES_DB: testsupport
- name: Release
if: >
github.event.release &&
github.ref_name == 'main'
run: |
git config --global user.email "[email protected]"
git config --global user.name "DenktMit eG"
mvn -Drevision=${{ github.event.release.tag_name }} -Dchangelist= -B -ntp -DskipTests -Pci-cd
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}