add pipeline 12
This commit is contained in:
@@ -6,24 +6,49 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 🧾 Repository auschecken
|
- name: 🧾 Repository auschecken
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 🧼 IP-Adresse von Gitea zu /etc/hosts hinzufügen
|
- name: 🛠 Baue Projekt ohne Tests
|
||||||
run: echo "172.26.0.2 gitea" >> /etc/hosts
|
|
||||||
|
|
||||||
- name: 🛠 Baue das Projekt mit Gradle (ohne Tests)
|
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./gradlew
|
./gradlew clean build -x test
|
||||||
./gradlew build -x test
|
|
||||||
|
|
||||||
- name: 🐳 Docker Compose Build & Deploy
|
- name: 📦 Archiviere Build-Artefakt
|
||||||
run: docker compose -f ./compose.yml up -d --build
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: app-jar
|
||||||
|
path: build/libs/MyTimeTracker-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
- name: 🧹 Clean Up (optional)
|
deploy:
|
||||||
if: always()
|
needs: build
|
||||||
run: docker system prune -f
|
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
|
||||||
Reference in New Issue
Block a user