-
Notifications
You must be signed in to change notification settings - Fork 95
41 lines (39 loc) · 1.08 KB
/
conditional-statement.yml
File metadata and controls
41 lines (39 loc) · 1.08 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
name: Java Maven CI/CD Pipeline*
on:
push:
branches:
- master
jobs:
build-test:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout source code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Java
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
cache: maven
# Step 3: Build and test using Maven
- name: run the step only if branch name is main
if: github.ref == 'refs/heads/master'
run: mvn clean test
package-deploy:
needs: build-test
runs-on: ubuntu-latest
steps:
# step 1: Checkout source code
- name: Checkout code
uses: actions/checkout@v4
# step 2: Test using Maven
- name: package the application
run: mvn clean package -DskipTests
# Step 3: Upload build artifact (Deploy stage example)
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: helloworldweb-artifact
path: target/*.war