This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (37 loc) · 1.39 KB
/
maven.yml
File metadata and controls
48 lines (37 loc) · 1.39 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
42
43
44
45
46
47
48
name: Build
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
env:
GAMMA_KEY: ${{ secrets.GAMMA_KEY }}
GAMMA_HOST: ${{ secrets.GAMMA_HOST }}
GAMMA_USER: ${{ secrets.GAMMA_USER }}
environment:
name: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Deploy to Server
run: |
echo "⚙️ Setup GAMMA SSH Key"
mkdir -p ~/.ssh
echo "$GAMMA_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
echo "🔁 Suppression du service distant existant..."
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $GAMMA_USER@$GAMMA_HOST "systemctl stop $SERVICE_NAME.service && rm -f $SERVICE_PATH/$SERVICE_NAME-*.jar"
echo "📦 Upload du nouveau build..."
scp -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no target/$SERVICE_NAME-*.jar $GAMMA_USER@$GAMMA_HOST:$SERVICE_PATH
echo "♻️ Redémarrage du service..."
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $GAMMA_USER@$GAMMA_HOST "systemctl restart $SERVICE_NAME.service"
env:
SERVICE_NAME: ${{ vars.SERVICE_NAME }}
SERVICE_PATH: ${{ vars.SERVICE_PATH }}