From aeaab85371a02d532eac4dcc448f970b3b2bd04e Mon Sep 17 00:00:00 2001 From: kurihada Date: Mon, 1 Jun 2026 16:35:24 +0800 Subject: [PATCH] Add Gitea Actions workflow (migrated from Jenkins) --- .gitea/workflows/deploy.yml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..a0e03b3 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Build and Deploy + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + container: + image: openjdk:21 + options: -v /var/run/docker.sock:/var/run/docker.sock + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Maven cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: maven-${{ hashFiles('pom.xml') }} + restore-keys: maven- + + - name: Build with Maven + run: mvn clean install -Dmaven.test.skip=true + + - name: Build Docker image + run: | + docker build -t auth-backend:latest -t auth-backend:${{ github.sha }} . + + - name: Deploy + run: | + docker stop auth-backend-container || true + docker rm auth-backend-container || true + docker run -d \ + --name auth-backend-container \ + --network nginx \ + -p 9001:9001 \ + --restart unless-stopped \ + auth-backend:latest