feat(ci): 使用时间戳标签确保每次部署都触发更新
This commit is contained in:
@@ -46,10 +46,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: |
|
||||||
@@ -61,8 +62,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
|
||||||
|
|||||||
Reference in New Issue
Block a user