diff --git a/.github/delete-merged-branch-config.yml b/.github/delete-merged-branch-config.yml
new file mode 100644
index 0000000..663e948
--- /dev/null
+++ b/.github/delete-merged-branch-config.yml
@@ -0,0 +1,4 @@
+exclude: 
+  - upstream
+  - feature-*
+delete_closed_pr: true
diff --git a/.github/pull.yml b/.github/pull.yml
new file mode 100644
index 0000000..61aeb6d
--- /dev/null
+++ b/.github/pull.yml
@@ -0,0 +1,7 @@
+version: "1"
+rules:                     
+  - base: upstream
+    upstream: damonto:main
+    mergeMethod: merge
+    mergeUnstable: false
+
diff --git a/.github/workflows/clean-workflows.yml b/.github/workflows/clean-workflows.yml
new file mode 100644
index 0000000..4d82474
--- /dev/null
+++ b/.github/workflows/clean-workflows.yml
@@ -0,0 +1,15 @@
+name: 'Auto cleaning of workflow logs'
+
+on:
+  schedule:
+    - cron: '0 0 * * 0'
+  workflow_dispatch:
+
+jobs:
+  del_workflow:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Delete workflow runs
+        uses: GitRML/delete-workflow-runs@main
+        with:
+          retain_days: '7'
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 0644eca..3d07cd2 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -2,10 +2,12 @@ name: Docker Image
 
 on:
   workflow_dispatch:
+    inputs:
+      tag:
+        description: 'Tag name'
+        required: true
   push:
     tags: [v*]
-  pull_request:
-    branches: [main]
 
 permissions:
   contents: read
@@ -21,13 +23,14 @@ jobs:
         platform:
           - linux/amd64
           - linux/arm64
-          - linux/arm/v7
+
     steps:
       - name: Checkout code
         uses: actions/checkout@v4
         with:
           fetch-depth: 0
           submodules: recursive
+          ref: ${{ github.event.inputs.tag || github.ref }}
 
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v3
@@ -50,18 +53,21 @@ jobs:
           username: ${{ github.repository_owner }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
+      - name: Convert repository owner to lowercase
+        id: lowercase-owner
+        run: echo "lowercase_owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
+
       - name: Docker meta
         id: meta
         uses: docker/metadata-action@v5
         with:
           images: |
-            ghcr.io/${{ github.repository_owner }}/estkme-cloud
+            ghcr.io/${{ env.lowercase_owner }}/estkme-cloud
           tags: |
-            type=raw,value=latest,enable={{is_default_branch}}
+            type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
             type=semver,pattern={{version}}
             type=semver,pattern={{major}}.{{minor}}
             type=semver,pattern={{major}}
-            type=ref,event=branch
             type=ref,event=tag
 
       - name: Build and push by digest
@@ -72,11 +78,11 @@ jobs:
           platforms: ${{ matrix.platform }}
           build-args: |
             BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
-            VERSION=${{ steps.meta.outputs.version }}
+            VERSION=${{ github.event.inputs.tag || steps.meta.outputs.version }}
           provenance: false
           labels: ${{ steps.meta.outputs.labels }}
           annotations: ${{ steps.meta.outputs.annotations }}
-          outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/estkme-cloud,docker.io/${{ secrets.DOCKERHUB_USERNAME }}/estkme-cloud",push-by-digest=true,name-canonical=true,push=${{ startsWith(github.ref, 'refs/tags/v') }}
+          outputs: type=image,"name=ghcr.io/${{ env.lowercase_owner }}/estkme-cloud,docker.io/${{ secrets.DOCKERHUB_USERNAME }}/estkme-cloud",push-by-digest=true,name-canonical=true,push=true
           cache-from: type=gha
           cache-to: type=gha,mode=max
 
@@ -101,7 +107,7 @@ jobs:
 
   merge:
     name: Merge and Push image manifest
-    if: ${{ startsWith(github.ref, 'refs/tags/v') }}
+    if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event.inputs.tag }}
     runs-on: ubuntu-latest
     needs:
       - build
@@ -116,19 +122,22 @@ jobs:
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v3
 
+      - name: Set repository owner
+        id: set_repo_owner
+        run: echo "REPO_OWNER_1=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
+
       - name: Docker meta
         id: meta
         uses: docker/metadata-action@v5
         with:
           images: |
-            ghcr.io/${{ github.repository_owner }}/estkme-cloud
+            ghcr.io/${{ env.REPO_OWNER_1 }}/estkme-cloud
             docker.io/${{ secrets.DOCKERHUB_USERNAME }}/estkme-cloud
           tags: |
-            type=raw,value=latest,enable={{is_default_branch}}
+            type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
             type=semver,pattern={{version}}
             type=semver,pattern={{major}}.{{minor}}
             type=semver,pattern={{major}}
-            type=ref,event=branch
             type=ref,event=tag
         env:
           DOCKER_METADATA_ANNOTATIONS_LEVELS: index
@@ -152,12 +161,13 @@ jobs:
           set -x
           annotations=$(jq -cr '.annotations | map((split("=")[0] + "=\"" + split("=")[1] + "\"") | "--annotation " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
           tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
-          eval "docker buildx imagetools create $annotations $tags $(printf 'ghcr.io/${{ github.repository_owner }}/estkme-cloud@sha256:%s ' *)"
+          digests=$(ls -1 | tr '\n' ' ' | sed 's#^#ghcr.io/${{ env.REPO_OWNER_1 }}/estkme-cloud@sha256:#' | tr '[:upper:]' '[:lower:]')
+          eval "docker buildx imagetools create $annotations $tags $digests"
 
       - name: Inspect image
         run: |
           docker buildx imagetools inspect docker.io/${{ secrets.DOCKERHUB_USERNAME }}/estkme-cloud:${{ steps.meta.outputs.version }}
-          docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/estkme-cloud:${{ steps.meta.outputs.version }}
+          docker buildx imagetools inspect ghcr.io/${{ env.REPO_OWNER_1 }}/estkme-cloud:${{ steps.meta.outputs.version }}
 
   cleanup:
     name: Cleanup
@@ -169,3 +179,4 @@ jobs:
         uses: dataaxiom/ghcr-cleanup-action@v1
         with:
           token: ${{ github.token }}
+        continue-on-error: true
diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml
new file mode 100644
index 0000000..2864d67
--- /dev/null
+++ b/.github/workflows/sync.yml
@@ -0,0 +1,40 @@
+name: Upstream Sync
+
+permissions:
+  contents: write
+
+on:
+  schedule:
+    - cron: "0 0 * * *" # every day
+  workflow_dispatch:
+
+jobs:
+  sync_latest_from_upstream:
+    name: Sync latest commits from upstream repo
+    runs-on: ubuntu-latest
+    if: ${{ github.event.repository.fork }}
+
+    steps:
+      # Step 1: run a standard checkout action
+      - name: Checkout target repo
+        uses: actions/checkout@v4
+
+      # Step 2: run the sync action
+      - name: Sync upstream changes
+        id: sync
+        uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
+        with:
+          upstream_sync_repo: https://github.com/damonto/estkme-cloud
+          upstream_sync_branch: main
+          target_sync_branch: upstream
+          target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
+
+          # Set test_mode true to run tests instead of the true action!!
+          test_mode: false
+
+      - name: Sync check
+        if: failure()
+        run: |
+          echo "[Error] 由于上游仓库的 workflow 文件变更,导致 GitHub 自动暂停了本次自动更新,你需要手动 Sync Fork 一次,详细教程请查看:https://github.com/Yidadaa/ChatGPT-Next-Web/blob/main/README_CN.md#%E6%89%93%E5%BC%80%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%96%B0"
+          echo "[Error] Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork. Please refer to the detailed tutorial for instructions: https://github.com/Yidadaa/ChatGPT-Next-Web#enable-automatic-updates"
+          exit 1
diff --git a/.github/workflows/tag-and-build.yml b/.github/workflows/tag-and-build.yml
new file mode 100644
index 0000000..be22ab1
--- /dev/null
+++ b/.github/workflows/tag-and-build.yml
@@ -0,0 +1,40 @@
+name: Tag and Build on PR Merge
+
+on:
+  pull_request:
+    types: [closed]
+
+jobs:
+  tag-and-build:
+    runs-on: ubuntu-latest
+    if: github.event.pull_request.merged == true
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Generate tag name
+        id: generate_tag
+        run: |
+          TAG_NAME="v$(TZ=UTC-8 date +'%Y%m%d%H%M')"
+          COUNT=1
+          while git rev-parse $TAG_NAME >/dev/null 2>&1; do
+            TAG_NAME="${TAG_NAME}-${COUNT}"
+            COUNT=$((COUNT + 1))
+          done
+          echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
+
+      - name: Create tag
+        run: |
+          git tag ${{ env.TAG_NAME }}
+          git push origin ${{ env.TAG_NAME }}
+
+      - name: Trigger build workflow
+        uses: benc-uk/workflow-dispatch@v1
+        with:
+          workflow: docker.yml
+          token: ${{ secrets.GITHUB_TOKEN }}
+          ref: ${{ github.ref }}
+          inputs: '{"tag": "${{ env.TAG_NAME }}"}'