feat(ci): 使用时间戳标签确保每次部署都触发更新

This commit is contained in:
2026-07-19 21:57:23 +08:00
parent e7bdaeb62e
commit fd63ca698f
+3 -3
View File
@@ -31,10 +31,11 @@ jobs:
- name: Build & Push Docker image - name: Build & Push Docker image
run: | run: |
TAG=${{ gitea.sha }} TAG=${{ gitea.sha }}-$(date +%s)
docker build -t $REGISTRY/$APP:$TAG -t $REGISTRY/$APP:${{ inputs.environment }} . docker build -t $REGISTRY/$APP:$TAG -t $REGISTRY/$APP:${{ inputs.environment }} .
docker push $REGISTRY/$APP:$TAG docker push $REGISTRY/$APP:$TAG
docker push $REGISTRY/$APP:${{ inputs.environment }} docker push $REGISTRY/$APP:${{ inputs.environment }}
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
- name: Setup kubectl - name: Setup kubectl
run: | run: |
@@ -46,8 +47,7 @@ jobs:
- name: Deploy to K8s - name: Deploy to K8s
run: | run: |
TAG=${{ gitea.sha }} kubectl set image deployment/$APP $APP=$REGISTRY/$APP:$IMAGE_TAG -n lpt-${{ inputs.environment }} --record
kubectl set image deployment/$APP $APP=$REGISTRY/$APP:$TAG -n lpt-${{ inputs.environment }} --record
kubectl rollout status deployment/$APP -n lpt-${{ inputs.environment }} --timeout=5m kubectl rollout status deployment/$APP -n lpt-${{ inputs.environment }} --timeout=5m
- name: Rollback on failure - name: Rollback on failure