From 373fac5545a3961e7ac4ef138fa6356d5e0134f6 Mon Sep 17 00:00:00 2001 From: Eduard Kuksa Date: Tue, 18 Feb 2025 20:57:59 +0700 Subject: [PATCH] add spring-dotenv and gitea actions maven build pipeline --- .gitea/workflows/main.yaml | 72 ++++++++++++++++++++++++++++++++++++++ application.yaml | 6 ++-- pom.xml | 9 +++-- 3 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 .gitea/workflows/main.yaml diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml new file mode 100644 index 0000000..332d817 --- /dev/null +++ b/.gitea/workflows/main.yaml @@ -0,0 +1,72 @@ +name: Gitea Action Maven build + +on: + push: + branches: ['master'] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout the repo + uses: actions/checkout@v4 + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.9 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: 'oracle' + cache: 'maven' + - name: Build, Test and Package with Maven + run: mvn -B verify --file pom.xml -e + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: searchengine-artifact + path: | + target/*.jar +# Dockerfile +# docker-compose.yml +# - name: Create Maven settings.xml +# run: | +# cat < ~/.m2/settings.xml +# +# +# +# gitea +# ${{ vars.OWNER }} +# ${{ secrets.ACCESS_TOKEN }} +# +# +# +# EOF +# - name: Replace {owner} in pom.xml +# run: sed -i "s/{owner}/${{ vars.OWNER }}/g" pom.xml +# - name: Deploy to Gitea Packages +# run: mvn deploy +# deploy: +# runs-on: ubuntu-latest +# needs: build +# steps: +# - name: Download artifact +# uses: actions/download-artifact@v3 +# with: +# name: app-artifact +# path: artifact +# - name: Install SSH Key +# uses: shimataro/ssh-key-action@v2 +# with: +# key: ${{ secrets.SSH_PRIVATE_KEY }} +# known_hosts: ${{ secrets.KNOWN_HOSTS }} +# - name: Deploy to Local Server +# run: scp -r artifact/* ${{ vars.DEPLOY_USER }}@${{ vars.DEPLOY_HOST }}:${{ vars.DEPLOY_PATH }} +# - name: Build and Run Docker Image with Docker Compose +# run: | +# ssh -T ${{ vars.DEPLOY_USER }}@${{ vars.DEPLOY_HOST }} << EOF +# cd ${{ vars.DEPLOY_PATH }} +# docker compose down +# docker compose up -d --build +# EOF \ No newline at end of file diff --git a/application.yaml b/application.yaml index fee03e0..57ecf45 100644 --- a/application.yaml +++ b/application.yaml @@ -3,9 +3,9 @@ server: spring: datasource: - username: root - password: hRMH94dJ - url: jdbc:mysql://localhost:3306/search_engine?useSSL=false&requireSSL=false&allowPublicKeyRetrieval=true + username: ${DB_USER} + password: ${DB_PASSWORD} + url: ${DB_URL} jpa: hibernate: ddl-auto: update diff --git a/pom.xml b/pom.xml index cedc726..6174488 100644 --- a/pom.xml +++ b/pom.xml @@ -9,8 +9,8 @@ 1.0-SNAPSHOT - 23 - 23 + 21 + 21 UTF-8 @@ -45,5 +45,10 @@ 8.4.0 runtime + + me.paulschwarz + spring-dotenv + 4.0.0 + \ No newline at end of file