Skip to content

Commit 41d85a5

Browse files
authored
Merge pull request #1 from thughari/dev
Update main.yml
2 parents b78a564 + 4016836 commit 41d85a5

1 file changed

Lines changed: 39 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
1-
name: My Deploy
1+
name: CI for Spring Boot Microservice
22

3+
# Trigger workflow on push or pull request to main branch
34
on:
4-
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
511

612
jobs:
713
build:
814
runs-on: ubuntu-latest
15+
916
steps:
10-
- name: Deploy to production
11-
uses: johnbeynon/render-deploy-action@v0.0.8
17+
# Step 1: Checkout code
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
# Step 2: Set up Java (match your Spring Boot version)
22+
- name: Set up Java 17
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: 'temurin'
26+
java-version: '17'
27+
28+
# Step 3: Cache Maven dependencies (optional, speeds up builds)
29+
- name: Cache Maven packages
30+
uses: actions/cache@v3
1231
with:
13-
service-id: ${{ secrets.MY_RENDER_SERVICE_ID }}
14-
api-key: ${{ secrets.MY_RENDER_API_KEY }}
15-
wait-for-success: true
32+
path: ~/.m2/repository
33+
key: ${{ runner.os }}-maven-${{ hashFiles('/pom.xml') }}
34+
restore-keys: |
35+
${{ runner.os }}-maven-
36+
37+
# Step 4: Build the Spring Boot project
38+
- name: Build with Maven
39+
run: mvn clean package -DskipTests
40+
41+
# Step 5: (Optional) Run tests
42+
- name: Run tests
43+
run: mvn test
44+
45+
# Step 6: (Optional) List the generated jar
46+
- name: List target directory
47+
run: ls -l target/

0 commit comments

Comments
 (0)