Merge pull request 'rc' (#2) from dev into main
All checks were successful
Build and Deploy Versioned Spring Boot Server / build (push) Successful in 9m54s

Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
2025-01-12 05:18:03 -08:00
2 changed files with 39 additions and 11 deletions

View File

@@ -2,8 +2,8 @@ name: Build and Deploy Versioned Spring Boot Server
on:
push:
tags: # Match all tags
- "*"
tags:
- "*" # Match all tags
jobs:
build:
@@ -43,20 +43,42 @@ jobs:
- name: Extract Tag Version
id: extract_version
run: |
TAG_VERSION=${GITEA_REF#refs/tags/}
TAG_VERSION=$(echo "${GITHUB_REF}" | sed 's#refs/tags/##')
if [ -z "$TAG_VERSION" ]; then
echo "Error: TAG_VERSION is empty."
exit 1
fi
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
# Extract major and minor versions
MAJOR_VERSION=$(echo "${TAG_VERSION}" | cut -d. -f1)
MINOR_VERSION=$(echo "${TAG_VERSION}" | cut -d. -f1,2)
echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
# 7. Build the Docker image with the tag
- name: Build and Package Docker Image
run: |
docker build -t tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} .
# 8. Docker login
# 8. Tag the image with Major Version (e.g., 0)
- name: Tag with Major Version
run: |
docker tag tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} tea.zendric.de/cedric/xpensely-server:${{ env.MAJOR_VERSION }}
# 9. Tag the image with Minor Version (e.g., 0.1)
- name: Tag with Minor Version
run: |
docker tag tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} tea.zendric.de/cedric/xpensely-server:${{ env.MINOR_VERSION }}
# 10. Docker login
- name: Login to Docker Registry
run: |
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
# 9. Push the Docker image with the tag
# 11. Push the Docker images with the tags
- name: Push the Docker Image to registry
run: |
docker push tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }}
docker push tea.zendric.de/cedric/xpensely-server:${{ env.MAJOR_VERSION }}
docker push tea.zendric.de/cedric/xpensely-server:${{ env.MINOR_VERSION }}

View File

@@ -1,15 +1,17 @@
version: "3.8"
services:
xpensely-server:
image: tea.zendric.de/cedric/xpensely-server:latest
image: tea.zendric.de/cedric/xpensely-server:0
labels:
net.unraid.docker.icon: https://tea.zendric.de/Cedric/XpenselyServer/raw/branch/main/src/main/resources/static/xpensely_icon_white.png
container_name: xpensely-server
ports:
- 3636:8080
environment:
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
DB_PORT: 5434
DB_NAME: ${DB_P_NAME}
DB_PORT: 5432
DB_P_NAME: xpensely
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
depends_on:
@@ -18,12 +20,14 @@ services:
networks:
- xpensely-network
postgresdb:
labels:
net.unraid.docker.icon: https://raw.githubusercontent.com/docker-library/docs/01c12653951b2fe592c1f93a13b4e289ada0e3a1/postgres/logo.png
image: postgres:14
container_name: postgresdb
ports:
- 5434:5432
- 5432:5432
environment:
POSTGRES_DB: ${DB_P_NAME}
POSTGRES_DB: xpensely
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
networks:
@@ -32,7 +36,9 @@ services:
- db_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
test:
- CMD-SHELL
- pg_isready -U ${DB_USERNAME} -d xpensely
interval: 10s
timeout: 5s
retries: 5