39 lines
1.0 KiB
YAML
39 lines
1.0 KiB
YAML
name: lpt-fe Build & Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
description: '部署环境'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- dev
|
|
- prod
|
|
|
|
env:
|
|
REGISTRY: 192.168.123.199:5000
|
|
APP: lpt-fe
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build & Push Docker image
|
|
run: |
|
|
TAG=${{ github.sha }}
|
|
docker build \
|
|
--build-arg BUILD_MODE=${{ inputs.environment == 'prod' && 'production' || 'development' }} \
|
|
-t $REGISTRY/$APP:$TAG \
|
|
-t $REGISTRY/$APP:${{ inputs.environment }} .
|
|
docker push $REGISTRY/$APP:$TAG
|
|
docker push $REGISTRY/$APP:${{ inputs.environment }}
|
|
|
|
- name: Deploy to K8s
|
|
run: |
|
|
TAG=${{ github.sha }}
|
|
kubectl set image deployment/$APP $APP=$REGISTRY/$APP:$TAG -n lpt-${{ inputs.environment }}
|
|
kubectl rollout status deployment/$APP -n lpt-${{ inputs.environment }}
|