tag releases
All checks were successful
Build and Deploy Spring Boot Server / build (push) Successful in 9m53s
All checks were successful
Build and Deploy Spring Boot Server / build (push) Successful in 9m53s
This commit is contained in:
62
.gitea/workflows/tag_release.yml
Normal file
62
.gitea/workflows/tag_release.yml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
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=${GITEA_REF#refs/tags/}
|
||||||
|
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 }}
|
||||||
Reference in New Issue
Block a user