From e14cd94fd9bf1494524bb58c39af8186cbd1e8ce Mon Sep 17 00:00:00 2001 From: zyronon Date: Sat, 20 Apr 2024 16:07:09 +0800 Subject: [PATCH] refactor: update workflow --- .github/workflows/deploy-gitee-pages.yml | 64 ++++++++++++++++++ .github/workflows/deploy-pages.yml | 17 +++-- .../data/detail_comments_2024-03-29.json | 4 +- node/remove-dist-json.js | 33 +++++++++ node/user/data.js | 2 +- node/user/user.json | 2 +- package.json | 3 +- .../video_id_7321200290739326262.json | 4 +- ...ser-LL991221.z.json => user-LL991221.json} | 0 ...er-LL991221.z.json.md => user-LL991221.md} | Bin public/data/users.json | 2 +- 11 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/deploy-gitee-pages.yml create mode 100644 node/remove-dist-json.js rename public/data/user_video_list/{user-LL991221.z.json => user-LL991221.json} (100%) rename public/data/user_video_list/{user-LL991221.z.json.md => user-LL991221.md} (100%) diff --git a/.github/workflows/deploy-gitee-pages.yml b/.github/workflows/deploy-gitee-pages.yml new file mode 100644 index 0000000..97be1b6 --- /dev/null +++ b/.github/workflows/deploy-gitee-pages.yml @@ -0,0 +1,64 @@ +# 将静态内容部署到 GitHub Pages 的简易工作流程 +name: Deploy static content to Pages + +on: + # 仅在推送到默认分支时运行。 + push: + branches: [ 'master' ] + + # 这个选项可以使你手动在 Action tab 页面触发工作流 + workflow_dispatch: + +# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。 +permissions: + contents: write + pages: write + id-token: write + +# 允许一个并发的部署 +concurrency: + group: 'pages' + cancel-in-progress: true + +jobs: + # 单次部署的工作描述 + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm run build-gitee-pages + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + publish_branch: gitee-pages + + - name: Sync to Gitee + uses: wearerequired/git-mirror-action@master + env: + SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }} + with: + source-repo: git@github.com:zyronon/douyin.git + destination-repo: git@gitee.com:zyronon/douyin.git \ No newline at end of file diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 9903157..b8b0780 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -11,7 +11,7 @@ on: # 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。 permissions: - contents: write + contents: read pages: write id-token: write @@ -48,11 +48,18 @@ jobs: - name: Build run: pnpm run build - - name: Deploy to gh-pages - uses: peaceiris/actions-gh-pages@v4 + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist + # Upload dist repository + path: './dist' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 - name: Sync to Gitee uses: wearerequired/git-mirror-action@master diff --git a/node/comment/data/detail_comments_2024-03-29.json b/node/comment/data/detail_comments_2024-03-29.json index 336d449..3e01f78 100644 --- a/node/comment/data/detail_comments_2024-03-29.json +++ b/node/comment/data/detail_comments_2024-03-29.json @@ -5734,7 +5734,7 @@ "user_id": "1028766474441803", "sec_uid": "MS4wLjABAAAAonK7FndgFYn4mKBQwHc34iEiCCwvBI3tXNqGXqd18qFM9p_ZSxC1y9Gyv1e0XuG_", "short_user_id": "3643612610", - "user_unique_id": "LL991221.z", + "user_unique_id": "LL991221", "user_signature": "🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)", "nickname": "我才是岚岚", "avatar": "https://p3-pc.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-avt-0015_78ecf820d31560e298e32684589c00b3.jpeg?from=2956013662", @@ -5954,7 +5954,7 @@ "user_id": "1028766474441803", "sec_uid": "MS4wLjABAAAAonK7FndgFYn4mKBQwHc34iEiCCwvBI3tXNqGXqd18qFM9p_ZSxC1y9Gyv1e0XuG_", "short_user_id": "3643612610", - "user_unique_id": "LL991221.z", + "user_unique_id": "LL991221", "user_signature": "🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)", "nickname": "我才是岚岚", "avatar": "https://p3-pc.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-avt-0015_78ecf820d31560e298e32684589c00b3.jpeg?from=2956013662", diff --git a/node/remove-dist-json.js b/node/remove-dist-json.js new file mode 100644 index 0000000..8f62960 --- /dev/null +++ b/node/remove-dist-json.js @@ -0,0 +1,33 @@ +import fs from 'fs' +import path from 'path' + +let read = 'dist/data' + +function deleteFile(url, name) { + var files = [] + + if (fs.existsSync(url)) { + //判断给定的路径是否存在 + + files = fs.readdirSync(url) //返回文件和子目录的数组 + + files.forEach(function (file) { + var curPath = path.join(url, file) + + if (fs.statSync(curPath).isDirectory()) { + //同步读取文件夹文件,如果是文件夹,则函数回调 + deleteFile(curPath, name) + } else { + if (file.indexOf(name) > -1) { + //是指定文件,则删除 + fs.unlinkSync(curPath) + console.log('删除文件:' + curPath) + } + } + }) + } else { + console.log('给定的路径不存在!') + } +} + +deleteFile(read, '.json') diff --git a/node/user/data.js b/node/user/data.js index 79ecfc0..0d1b962 100644 --- a/node/user/data.js +++ b/node/user/data.js @@ -727,7 +727,7 @@ export const users = [ signature: '🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)', total_favorited: 16475958, uid: '1028766474441803', - unique_id: 'LL991221.z', + unique_id: 'LL991221', user_age: 23, white_cover_url: [ { diff --git a/node/user/user.json b/node/user/user.json index 7c207cf..cf7e539 100644 --- a/node/user/user.json +++ b/node/user/user.json @@ -693,7 +693,7 @@ "signature": "🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)", "total_favorited": 16475958, "uid": "1028766474441803", - "unique_id": "LL991221.z", + "unique_id": "LL991221", "user_age": 23, "white_cover_url": [ { diff --git a/package.json b/package.json index 64666d5..36e22bb 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,10 @@ "start": "vite --host", "serve": "vite --host", "build": "vite build --mode prod", + "test-del-json": "node node/remove-dist-json.js", "build-uni-app": "vite build --mode uni", "build-gp-pages": "vite build --mode gp_pages", - "build-gitee-pages": "vite build --mode gitee_pages", + "build-gitee-pages": "vite build --mode gitee_pages && pnpm run test-del-json", "build-only": "vite build", "build-check": "run-p type-check \"build-only {@}\" --", "type-check": "vue-tsc --build --force", diff --git a/public/data/comments/video_id_7321200290739326262.json b/public/data/comments/video_id_7321200290739326262.json index 83d4492..d4a327f 100644 --- a/public/data/comments/video_id_7321200290739326262.json +++ b/public/data/comments/video_id_7321200290739326262.json @@ -14,7 +14,7 @@ "user_id": "1028766474441803", "sec_uid": "MS4wLjABAAAAonK7FndgFYn4mKBQwHc34iEiCCwvBI3tXNqGXqd18qFM9p_ZSxC1y9Gyv1e0XuG_", "short_user_id": "3643612610", - "user_unique_id": "LL991221.z", + "user_unique_id": "LL991221", "user_signature": "🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)", "nickname": "我才是岚岚", "avatar": "https://p3-pc.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-avt-0015_78ecf820d31560e298e32684589c00b3.jpeg?from=2956013662", @@ -168,7 +168,7 @@ "user_id": "1028766474441803", "sec_uid": "MS4wLjABAAAAonK7FndgFYn4mKBQwHc34iEiCCwvBI3tXNqGXqd18qFM9p_ZSxC1y9Gyv1e0XuG_", "short_user_id": "3643612610", - "user_unique_id": "LL991221.z", + "user_unique_id": "LL991221", "user_signature": "🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)", "nickname": "我才是岚岚", "avatar": "https://p3-pc.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-avt-0015_78ecf820d31560e298e32684589c00b3.jpeg?from=2956013662", diff --git a/public/data/user_video_list/user-LL991221.z.json b/public/data/user_video_list/user-LL991221.json similarity index 100% rename from public/data/user_video_list/user-LL991221.z.json rename to public/data/user_video_list/user-LL991221.json diff --git a/public/data/user_video_list/user-LL991221.z.json.md b/public/data/user_video_list/user-LL991221.md similarity index 100% rename from public/data/user_video_list/user-LL991221.z.json.md rename to public/data/user_video_list/user-LL991221.md diff --git a/public/data/users.json b/public/data/users.json index 7c207cf..cf7e539 100644 --- a/public/data/users.json +++ b/public/data/users.json @@ -693,7 +693,7 @@ "signature": "🧣我才是岚岚s\nX Eva: 我才是岚岚\n仅此一个抖音号(谨防被骗)", "total_favorited": 16475958, "uid": "1028766474441803", - "unique_id": "LL991221.z", + "unique_id": "LL991221", "user_age": 23, "white_cover_url": [ {