38 lines
912 B
YAML
38 lines
912 B
YAML
name: Build and Deploy Auction App
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build_and_deploy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: maven:3.9.6-eclipse-temurin-17
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build with Maven
|
|
run: mvn -B clean package
|
|
|
|
- name: Copy jar to server
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.SERVER_IP }}
|
|
username: ${{ secrets.SERVER_USER }}
|
|
key: ${{ secrets.SERVER_SSH_KEY }}
|
|
source: "target/*.jar"
|
|
target: "/opt/auction/app.jar"
|
|
|
|
- name: Restart service
|
|
uses: appleboy/ssh-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.SERVER_IP }}
|
|
username: ${{ secrets.SERVER_USER }}
|
|
key: ${{ secrets.SERVER_SSH_KEY }}
|
|
script: |
|
|
sudo systemctl restart auction
|