Some checks failed
Build and Deploy Versioned Spring Boot Server / build (push) Failing after 4s
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
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. Debug Environment Variables
|
|
- name: Debug Environment Variables
|
|
run: env
|
|
|
|
# 3. Extract the tag name
|
|
- name: Extract Tag Version
|
|
id: extract_version
|
|
run: |
|
|
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
|
|
|
|
# 4. Build and Package Docker Image
|
|
- name: Build and Package Docker Image
|
|
run: |
|
|
docker build -t tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} .
|
|
|
|
# 5. Docker login
|
|
- name: Login to Docker Registry
|
|
run: |
|
|
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
|
|
|
|
# 6. 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 }}
|