From 27f01a8e50f94da09452e2200cef111c9d98e204 Mon Sep 17 00:00:00 2001 From: huangliling Date: Wed, 28 Aug 2024 14:12:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20LC=20=E6=96=87=E6=A1=A3=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/build-leancloud.sh | 6 --- .ci/default.conf | 37 ----------------- ...ew-env-delete.yml => preview-deletion.yml} | 6 +-- ...-env-deploy.yml => preview-deployment.yml} | 6 +-- .../{main.yml => prod-deployment.yml} | 6 +-- .gitlab-ci.yml | 40 ------------------- .npmrc | 3 +- .vscode/settings.json | 5 --- Dockerfile | 15 ------- leanengine.yaml | 2 +- 10 files changed, 7 insertions(+), 119 deletions(-) delete mode 100755 .ci/build-leancloud.sh delete mode 100644 .ci/default.conf rename .github/workflows/{preview-env-delete.yml => preview-deletion.yml} (93%) rename .github/workflows/{preview-env-deploy.yml => preview-deployment.yml} (93%) rename .github/workflows/{main.yml => prod-deployment.yml} (87%) delete mode 100644 .gitlab-ci.yml delete mode 100644 .vscode/settings.json delete mode 100644 Dockerfile diff --git a/.ci/build-leancloud.sh b/.ci/build-leancloud.sh deleted file mode 100755 index cc25e8bca..000000000 --- a/.ci/build-leancloud.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -e - -# 构建 -yarn build --out-dir build-leancloud diff --git a/.ci/default.conf b/.ci/default.conf deleted file mode 100644 index f8c915334..000000000 --- a/.ci/default.conf +++ /dev/null @@ -1,37 +0,0 @@ -server { - listen 80; - server_name developer.xdrnd.cn developer.taptap.cn; - - location / { - root /usr/share/nginx/html/build-cn; - index index.html index.htm; - } - - error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html/build-cn; - } -} - -server { - listen 80; - server_name developer-intl.xdrnd.com developer.taptap.io; - - location / { - root /usr/share/nginx/html/build-hk; - index index.html index.htm; - } - - error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html/build-hk; - } -} diff --git a/.github/workflows/preview-env-delete.yml b/.github/workflows/preview-deletion.yml similarity index 93% rename from .github/workflows/preview-env-delete.yml rename to .github/workflows/preview-deletion.yml index cedea25e6..503dea9dd 100644 --- a/.github/workflows/preview-env-delete.yml +++ b/.github/workflows/preview-deletion.yml @@ -19,13 +19,11 @@ jobs: run: | sudo curl -L -o /bin/lean https://github.com/leancloud/lean-cli/releases/download/v1.2.3/lean-linux-x64 sudo chmod +x /bin/lean - - - name: Delete + - name: Delete Preview Environment run: | - lean login --region ${{ env.REGION }} --token ${{ secrets.ACCESS_TOKEN }} + lean login --region ${{ env.REGION }} --token ${{ secrets.LC_ACCESS_TOKEN }} lean switch --region ${{ env.REGION }} --group ${{ env.GROUP }} ${{ env.APP_ID }} lean preview delete - - uses: strumwolf/delete-deployment-environment@v2 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/preview-env-deploy.yml b/.github/workflows/preview-deployment.yml similarity index 93% rename from .github/workflows/preview-env-deploy.yml rename to .github/workflows/preview-deployment.yml index f8d00276c..7c70aa746 100644 --- a/.github/workflows/preview-env-deploy.yml +++ b/.github/workflows/preview-deployment.yml @@ -1,5 +1,3 @@ -# .github/workflows/preview-env-deploy.yml - name: Deploy Preview Environment on: @@ -19,15 +17,13 @@ jobs: url: ${{ env.PREVIEW_URL }} steps: - uses: actions/checkout@v3 - - name: Install lean-cli run: | sudo curl -L -o /bin/lean https://github.com/leancloud/lean-cli/releases/download/v1.2.3/lean-linux-x64 sudo chmod +x /bin/lean - - name: Deploy run: | - lean login --region ${{ env.REGION }} --token ${{ secrets.ACCESS_TOKEN }} + lean login --region ${{ env.REGION }} --token ${{ secrets.LC_ACCESS_TOKEN }} lean switch --region ${{ env.REGION }} --group ${{ env.GROUP }} ${{ env.APP_ID }} PREVIEW_URL=$(lean preview deploy) echo "PREVIEW_URL=$PREVIEW_URL" >> $GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/prod-deployment.yml similarity index 87% rename from .github/workflows/main.yml rename to .github/workflows/prod-deployment.yml index 5ff2c3ddd..e821dd465 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/prod-deployment.yml @@ -2,19 +2,15 @@ on: push: branches: [master] - schedule: - - cron: '0 */2 * * *' jobs: deploy: runs-on: ubuntu-latest - steps: - - name: Checkout Repository + - name: Checkout uses: actions/checkout@v2 with: token: ${{ secrets.CHECKOUT_TOKEN }} - - name: Deploy to LeanEngine uses: enflo/curl-action@v1.2 with: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index ff6a51c2b..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,40 +0,0 @@ -include: - - project: sre/gitlab-ci-templates - ref: v1 - file: - - /shared/build-and-push-image.yml - - /shared/deploy-kubefiles.yml - -stages: - - image - - deploy-staging - - deploy-production - -build-and-push-image: - stage: image - extends: - - .build-and-push-image - variables: - DOCKER_REGISTRY_NAMESPACE: tds - DOCKER_REGISTRY_REPO: tapsdkdoc - only: - - master - -deploy-staging: - stage: deploy-staging - extends: - - .deploy-kubefiles-staging - variables: - PROJECT_PATH: tds/tapsdkdoc - when: on_success - only: - - master - -deploy-production: - stage: deploy-production - extends: - - .deploy-kubefiles-production - variables: - PROJECT_PATH: tds/tapsdkdoc - only: - - master diff --git a/.npmrc b/.npmrc index ae444623a..fc9e0f8fa 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -registry=https://registry.npm.taobao.org +registry=https://registry.npmmirror.com +disturl=https://npmmirror.com/mirrors/node diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 6c2ff60b6..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "githubPullRequests.ignoredPullRequestBranches": [ - "master" - ] -} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 196ad59e1..000000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:18.8.0 as builder - -WORKDIR /app -COPY package.json yarn.lock ./ -RUN yarn install - -COPY . . -RUN yarn build --out-dir build-cn -RUN sh .ci/build-hk.sh - -FROM nginx:alpine3.17 - -COPY --from=builder "/app/build-cn" "/usr/share/nginx/html/build-cn" -COPY --from=builder "/app/build-hk" "/usr/share/nginx/html/build-hk" -COPY --from=builder "/app/.ci/default.conf" "/etc/nginx/conf.d/default.conf" diff --git a/leanengine.yaml b/leanengine.yaml index 4831181c6..eda7a8da2 100644 --- a/leanengine.yaml +++ b/leanengine.yaml @@ -1,2 +1,2 @@ -build: sh .ci/build-leancloud.sh +build: yarn build --out-dir build-leancloud run: serve build-leancloud -c static.json -l ${LEANCLOUD_APP_PORT}