Compare commits
3 Commits
50d274f36a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0876eecf50 | |||
| 5549691d50 | |||
| 46c8df45d6 |
+30
-28
@@ -12,43 +12,45 @@ jobs:
|
||||
steps:
|
||||
# 1. Checkout the code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# 2. Set up Java and Maven
|
||||
# 2. Set up Java and Maven (includes Maven, no separate install needed)
|
||||
- name: Set up JDK (Eclipse Temurin)
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "17"
|
||||
cache: maven
|
||||
|
||||
# 3. Verify Maven installation
|
||||
- name: Install Maven
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y maven
|
||||
mvn -version
|
||||
|
||||
# 4. Build the Spring Boot application
|
||||
# 3. Build the Spring Boot application
|
||||
- name: Build Spring Boot Application
|
||||
run: |
|
||||
mvn clean package -DskipTests
|
||||
run: mvn clean package -DskipTests
|
||||
|
||||
# 5. Set up Docker
|
||||
- name: Set up Docker
|
||||
run: |
|
||||
docker --version
|
||||
# 4. Set up Docker Buildx (enables layer caching)
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# 6. Build the Docker image
|
||||
- name: Build and Package Docker Image
|
||||
run: |
|
||||
docker build -t tea.zendric.de/cedric/xpensely-server:latest .
|
||||
|
||||
# 7. Docker login
|
||||
# 5. Docker login
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: tea.zendric.de
|
||||
username: ${{ secrets.TEAUSER }}
|
||||
password: ${{ secrets.TEAPASSWORD }}
|
||||
|
||||
# 6. Build and push Docker image with layer caching
|
||||
- name: Build and Push Docker Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: tea.zendric.de/cedric/xpensely-server:latest
|
||||
cache-from: type=registry,ref=tea.zendric.de/cedric/xpensely-server:buildcache
|
||||
cache-to: type=registry,ref=tea.zendric.de/cedric/xpensely-server:buildcache,mode=max
|
||||
|
||||
# 7. Trigger Dokploy to redeploy the dev server automatically
|
||||
- name: Trigger Dokploy Redeploy
|
||||
run: |
|
||||
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
|
||||
# 8. Push Docker image
|
||||
- name: Push the Docker Image to registry
|
||||
run: |
|
||||
docker push tea.zendric.de/cedric/xpensely-server:latest
|
||||
curl -X POST "${{ secrets.DOKPLOY_WEBHOOK_URL }}" \
|
||||
-H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \
|
||||
--fail
|
||||
|
||||
Reference in New Issue
Block a user