Files
auth-backend/.gitea/workflows/deploy.yml
T
kurihada aeaab85371
Build and Deploy / build-and-deploy (push) Has started running
Add Gitea Actions workflow (migrated from Jenkins)
2026-06-01 16:35:24 +08:00

43 lines
1.0 KiB
YAML

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