File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
21# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
42name : Pull Request Validator
5-
63on :
74 pull_request :
85 branches :
96 - master
107 - develop
11-
128permissions :
139 contents : read
14-
1510jobs :
1611 build :
1712 runs-on : ubuntu-latest
18-
1913 steps :
14+ # Check out the repository source code.
2015 - name : Check out the code
2116 uses : actions/checkout@v4
22-
17+ # Set up Java 17 and enable Maven dependency caching.
2318 - name : Set up JDK 17
2419 uses : actions/setup-java@v4
2520 with :
2621 java-version : ' 17'
2722 distribution : ' temurin'
2823 cache : maven
29-
24+ # Build the project with the snapshot profile for pull request validation.
3025 - name : Build with Maven
31- run : mvn --batch-mode --update-snapshots clean install --file pom.xml -P snapshot
32-
26+ run : mvn --batch-mode --update-snapshots clean install --file pom.xml -P snapshot
Original file line number Diff line number Diff line change 1+ name : Build & Deploy (Develop)
2+ on :
3+ push :
4+ # Usage is limited to the develop branch to avoid deploying snapshots on every push
5+ branches :
6+ - develop
7+ permissions :
8+ contents : read
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v4
15+ # Set up Java 17 and enable Maven dependency caching.
16+ - name : Set up JDK 17
17+ uses : actions/setup-java@v4
18+ with :
19+ java-version : ' 17'
20+ distribution : ' temurin'
21+ cache : maven
22+ # Restore the local Maven repository cache to speed up builds.
23+ - name : Cache local Maven repository
24+ uses : actions/cache@v4
25+ with :
26+ path : ~/.m2/repository
27+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28+ restore-keys : ${{ runner.os }}-maven-
29+ # Build the project and deploy the snapshot artifact.
30+ - name : Build & Deploy
31+ run : |
32+ mvn clean deploy -s settings.xml --batch-mode -P snapshot -Dchangelist=-SNAPSHOT
Original file line number Diff line number Diff line change 1- name : Build & Deploy (Master & Develop)
2-
1+ name : Build & Deploy (Master)
32on :
43 push :
4+ # Usage is limited to the master branch to avoid deploying releases on every push
55 branches :
66 - master
7- - develop
8-
97permissions :
108 contents : read
11-
129jobs :
1310 build :
14-
1511 runs-on : ubuntu-latest
16-
1712 steps :
13+ # Check out the repository source code.
1814 - name : Checkout
1915 uses : actions/checkout@v4
20-
16+ # Set up Java 17 and enable Maven dependency caching.
2117 - name : Set up JDK 17
2218 uses : actions/setup-java@v4
2319 with :
2420 java-version : ' 17'
2521 distribution : ' temurin'
2622 cache : maven
27-
23+ # Restore the local Maven repository cache to speed up builds.
2824 - name : Cache local Maven repository
2925 uses : actions/cache@v4
3026 with :
3127 path : ~/.m2/repository
3228 key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3329 restore-keys : ${{ runner.os }}-maven-
34-
30+ # Import the GPG signing key for release deployment.
3531 - name : Configure GPG Key
3632 run : echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
3733 env :
3834 GPG_SIGNING_KEY : ${{ secrets.GPG_SIGNING_KEY }}
39-
35+ # Build the project and deploy the release artifact.
4036 - name : Build & Deploy
4137 run : |
42- if [[ "${{ github.ref_name }}" == "master" ]]; then
43- mvn clean deploy -s settings.xml --batch-mode -P release -Dchangelist=
44- else
45- mvn clean deploy -s settings.xml --batch-mode -P snapshot -Dchangelist=-SNAPSHOT
46- fi
38+ mvn clean deploy -s settings.xml --batch-mode -P release -Dchangelist=
4739 env :
4840 CENTRAL_USERNAME : ${{ secrets.CENTRAL_USERNAME }}
4941 CENTRAL_PASSWORD : ${{ secrets.CENTRAL_PASSWORD }}
You can’t perform that action at this time.
0 commit comments