-
Notifications
You must be signed in to change notification settings - Fork 69
72 lines (59 loc) · 2.44 KB
/
maven.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
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on: [push, pull_request]
env:
MAVEN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Debug GitHub variables
run: |
echo "GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}"
echo "GITHUB_HEAD_REPOSITORY: ${GITHUB_HEAD_REPOSITORY}"
echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF}"
echo "GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}"
echo "GITHUB_REF: ${GITHUB_REF}"
echo "GITHUB_ACTOR: ${GITHUB_ACTOR}"
- name: Determine PR source branch and fork repository
id: vars
run: |
# Set BRANCH_NAME based on event type
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
else
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
fi
# Determine FORK_REPO with fallback logic
if [[ -n "${GITHUB_HEAD_REPOSITORY}" ]]; then
echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY}" >> $GITHUB_ENV
elif curl -s --head https://github.com/${GITHUB_ACTOR}/openhospital-core | grep "HTTP/[12].* 2[0-9][0-9]" > /dev/null; then
echo "FORK_REPO=${GITHUB_ACTOR}/openhospital-core" >> $GITHUB_ENV
else
echo "FORK_REPO=informatici/openhospital-core" >> $GITHUB_ENV
fi
- name: Log variables
run: |
echo "FORK_REPO: ${{ env.FORK_REPO }}"
echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
- name: Checkout core
run: |
git clone --depth=1 --no-single-branch https://github.com/${{ env.FORK_REPO }}.git openhospital-core
pushd openhospital-core
git checkout -B ${{ env.BRANCH_NAME }} origin/${{ env.BRANCH_NAME }} || git checkout develop
popd
- name: Install core
run: |
pushd openhospital-core
mvn install -DskipTests=true
popd
- name: Build with Maven
run: mvn install -DskipTests=true