54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
name: Build-und-Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 🧾 Repository auschecken
|
|
uses: actions/checkout@v3
|
|
|
|
- name: 🛠 Baue Projekt ohne Tests
|
|
run: |
|
|
./gradlew clean build -x test
|
|
|
|
- name: 📦 Archiviere Build-Artefakt
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-jar
|
|
path: build/libs/MyTimeTracker-0.0.1-SNAPSHOT.jar
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 📥 Lade Artefakt herunter
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: app-jar
|
|
|
|
- name: 🚀 Deployment via SSH
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.DEPLOY_HOST }}
|
|
username: ${{ secrets.DEPLOY_USER }}
|
|
key: ${{ secrets.DEPLOY_KEY }}
|
|
source: MyTimeTracker-0.0.1-SNAPSHOT.jar
|
|
target: /opt/mytimetracker/build/libs/
|
|
|
|
- name: 🐳 Starte Compose remote via SSH
|
|
uses: appleboy/ssh-action@v1.0.0
|
|
with:
|
|
host: ${{ secrets.DEPLOY_HOST }}
|
|
username: ${{ secrets.DEPLOY_USER }}
|
|
key: ${{ secrets.DEPLOY_KEY }}
|
|
script: |
|
|
cd /opt/mytimetracker
|
|
docker compose down
|
|
docker compose up -d --build |