feat: add deploy workflow

This commit is contained in:
652010_genpt 2024-09-30 20:57:55 +02:00
parent d8fcd11e67
commit 778d676f08
3 changed files with 49 additions and 29 deletions

36
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: Deploy application
on:
pull_request:
branches:
- main
types:
- opened
- closed
- synchronized
jobs:
build-code:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Compile the code
run: |
./mvnw compile
- name: Test the code
run: |
./mvnw test -Dmaven.test.skip=false -Dmaven.compile.skip=true
- name: Package the code
run: |
./mvnw package -Dmaven.compile.skip=true -Dmaven.test.skip=true

View file

@ -1,29 +0,0 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# 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:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'adopt'
cache: maven
- name: Build with Maven Wrapper
run: ./mvnw -B package

13
pom.xml
View file

@ -14,6 +14,19 @@
</parent>
<name>petclinic</name>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<!-- Generic properties -->