41 lines
899 B
YAML
41 lines
899 B
YAML
name: lpt-be Build & Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
description: '部署环境'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- dev
|
|
- prod
|
|
|
|
env:
|
|
REGISTRY: 192.168.123.199:5000
|
|
APP: lpt-be
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
|
|
- name: Build with Maven
|
|
run: ./mvnw package -DskipTests -B
|
|
|
|
- name: Build & Push Docker image
|
|
run: |
|
|
docker build -t $REGISTRY/$APP:${{ inputs.environment }} .
|
|
docker push $REGISTRY/$APP:${{ inputs.environment }}
|
|
|
|
- name: Deploy to K8s
|
|
run: |
|
|
kubectl rollout restart deployment/$APP -n lpt-${{ inputs.environment }}
|