Skip to content

Commit

Permalink
refactor: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zyronon committed Apr 20, 2024
1 parent 5ac7c46 commit e14cd94
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 13 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy-gitee-pages.yml
Original file line number Diff line number Diff line change
@@ -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: [email protected]:zyronon/douyin.git
destination-repo: [email protected]:zyronon/douyin.git
17 changes: 12 additions & 5 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。
permissions:
contents: write
contents: read
pages: write
id-token: write

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions node/comment/data/detail_comments_2024-03-29.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
33 changes: 33 additions & 0 deletions node/remove-dist-json.js
Original file line number Diff line number Diff line change
@@ -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')
2 changes: 1 addition & 1 deletion node/user/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
2 changes: 1 addition & 1 deletion node/user/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions public/data/comments/video_id_7321200290739326262.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion public/data/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

0 comments on commit e14cd94

Please sign in to comment.