Compare commits
3 Commits
f49530653b
...
0.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 3830449377 | |||
| 3db2806a04 | |||
| d26a9bffc5 |
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user