refactor: update workflow

This commit is contained in:
zyronon 2024-04-20 16:07:09 +08:00
parent 5ac7c46840
commit e14cd94fd9
11 changed files with 118 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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",

33
node/remove-dist-json.js Normal file
View File

@ -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')

View File

@ -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: [
{

View File

@ -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": [
{

View File

@ -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",

View File

@ -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",

View File

@ -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": [
{