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