feat(ci): 使用时间戳标签确保每次部署都触发更新
This commit is contained in:
@@ -31,13 +31,14 @@ jobs:
|
||||
|
||||
- name: Build & Push Docker image
|
||||
run: |
|
||||
TAG=${{ gitea.sha }}
|
||||
TAG=${{ gitea.sha }}-$(date +%s)
|
||||
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 }}
|
||||
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup kubectl
|
||||
run: |
|
||||
@@ -48,8 +49,7 @@ jobs:
|
||||
|
||||
- name: Deploy to K8s
|
||||
run: |
|
||||
TAG=${{ gitea.sha }}
|
||||
kubectl --kubeconfig=/tmp/kubeconfig set image deployment/$APP $APP=$REGISTRY/$APP:$TAG -n lpt-${{ inputs.environment }} --record
|
||||
kubectl --kubeconfig=/tmp/kubeconfig set image deployment/$APP $APP=$REGISTRY/$APP:$IMAGE_TAG -n lpt-${{ inputs.environment }} --record
|
||||
kubectl --kubeconfig=/tmp/kubeconfig rollout status deployment/$APP -n lpt-${{ inputs.environment }} --timeout=5m
|
||||
|
||||
- name: Rollback on failure
|
||||
|
||||
Reference in New Issue
Block a user