Skip to content

Commit 6f01eab

Browse files
authored
DEV: Decouple release and develop workflows (#40)
1 parent f24d025 commit 6f01eab

4 files changed

Lines changed: 119 additions & 75 deletions

File tree

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
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-
42
name: Pull Request Validator
5-
63
on:
74
pull_request:
85
branches:
96
- master
107
- develop
11-
128
permissions:
139
contents: read
14-
1510
jobs:
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
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 numberDiff line numberDiff line change
@@ -1,49 +1,41 @@
1-
name: Build & Deploy (Master & Develop)
2-
1+
name: Build & Deploy (Master)
32
on:
43
push:
4+
# Usage is limited to the master branch to avoid deploying releases on every push
55
branches:
66
- master
7-
- develop
8-
97
permissions:
108
contents: read
11-
129
jobs:
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 }}

0 commit comments

Comments
 (0)