test githubref
Some checks failed
Build and Deploy Versioned Spring Boot Server / build (push) Failing after 4s

This commit is contained in:
2025-01-12 11:42:23 +01:00
parent 00450cf2c2
commit 7cdc80a439
2 changed files with 7 additions and 72 deletions

View File

@@ -22,14 +22,15 @@ jobs:
- name: Extract Tag Version
id: extract_version
run: |
echo "GITEA_REF=${GITEA_REF}" # Debugging output
TAG_VERSION=$(echo "${GITEA_REF}" | sed 's#refs/tags/##')
if [ -z "$TAG_VERSION" ]; then
echo "Error: TAG_VERSION is empty. GITEA_REF=${GITEA_REF}"
echo "GITHUB_REF=${GITHUB_REF}" # Debugging output
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
echo "Extracted TAG_VERSION: ${TAG_VERSION}"
else
echo "Error: This workflow was not triggered by a tag."
exit 1
fi
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
echo "Extracted TAG_VERSION: $TAG_VERSION"
# 4. Build and Package Docker Image
- name: Build and Package Docker Image

View File

@@ -1,66 +0,0 @@
name: Build and Deploy Versioned Spring Boot Server
on:
push:
tags:
- "*" # Match all tags
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1. Checkout the code
- name: Checkout code
uses: actions/checkout@v2
# 2. Set up Java and Maven
- name: Set up JDK (Eclipse Temurin)
uses: actions/setup-java@v3
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
- name: Build Spring Boot Application
run: |
mvn clean package -DskipTests
# 5. Set up Docker
- name: Set up Docker
run: |
docker --version
# 6. Extract the tag name
- name: Extract Tag Version
id: extract_version
run: |
TAG_VERSION=$(echo "${GITEA_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
# 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
- 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
- name: Push the Docker Image to registry
run: |
docker push tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }}