Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 修复一些功能异常 #51

Merged
merged 10 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
167 changes: 167 additions & 0 deletions .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
## CD交付流水线
## - 部署到Github Pages
## - 部署到Vercel托管平台
## - 发布新的Github Release
## 参考资料:https://v2.vuepress.vuejs.org/zh/guide/deployment.html#github-pages

name: CD
on:
push:
branches:
- master
- next
workflow_dispatch:


## vercel 环境变量
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

jobs:
install-init:
name: "流水线初始化"
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.20.2

- name: PNPM Install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: true

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}

## 部署到Github-Pages
deploy-github:
name: "部署到Github-Pages"
needs: install-init
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore Dependencies From cache
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}


# 运行构建脚本
- name: Build VuePress Site
run: ./scripts/bundle build_proxy

- name: Deploy To GitHub Page
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: pages/github
build_dir: docs/.vuepress/dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

## 部署到vercel平台
# deploy-vercel:
# name: "部署到Vercel平台"
# needs: install-init
# runs-on: ubuntu-latest
# if: github.repository == '142vip/JavaScriptCollection'
# steps:
# - name: Checkout Code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Restore Dependencies From Cache
# uses: actions/cache@v3
# with:
# path: |
# node_modules
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
#
# - name: Pull Vercel Environment Information
# run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
#
# ## 注意:安装pnpm
# - name: Build Project Artifacts
# run: npm i pnpm@7 -g && vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
#
# - name: Deploy Project Artifacts to Vercel
# run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

## 版本发布
release:
name: "创建Github发布"
runs-on: ubuntu-latest
needs: install-init
## 主库master、next且执行release更新时执行
if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')

steps:
- name: Restore Dependencies From cache
uses: actions/cache@v3
with:
path: |
~/.pnpm-store
node_modules
key: ${{ runner.os }}-cache-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cache-

### 打成压缩包
- name: Create Zip Package
run: |
zip -r JavaScriptCollection.zip . \
-x "node_modules/*"

# 提取版本号
- name: Get New Version Number
id: extract_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"

# 创建发布版本
- name: Create New Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: v${{ steps.extract_version.outputs.version }}
body: |
Release ${{ steps.extract_version.outputs.version }}

### Features

### Bug Fixes

## 更新资源
- name: Upload Resource Assets
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./JavaScriptCollection.zip
asset_name: JavaScriptCollection.zip
asset_content_type: application/zip
116 changes: 116 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
## 代码CI快速集成流水线,lint、fix、build


name: CI
## 触发条件
on:
pull_request:
branches:
- 'master'
- 'next'
- '!pages/**'
push:
branches:
- master
- next
# 手动触发部署
workflow_dispatch:

schedule:
- cron: "0 0 1 * *"

jobs:
install-init:
name: "流水线初始化"
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: read

steps:
- name: checkout code
uses: actions/checkout@v3
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.20.2

- name: PNPM Install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: true

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
Base-Build:
name: "基础编译构建"
runs-on: ubuntu-latest
needs: install-init
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Restore Dependencies From Cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Code LintFix
run: ./scripts/lint --fix

- name: Build Site
run: ./scripts/bundle build

- name: Build Site With Proxy
run: ./scripts/bundle build_proxy

Build-Docker-Image:
name: "构建Docker镜像"
runs-on: ubuntu-latest
needs: install-init
## 主库master、next且执行release更新时执行
if: github.repository == '142vip/408CSFamily' && startsWith(github.event.head_commit.message, 'chore(release):')
permissions:
actions: read
pull-requests: read

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

- name: Login Docker
run: |
docker version
echo "-----------Docker Login-----------"
docker login \
--username=${{ env.UserName }} \
--password=${{ secrets.DOCKER_PASSWORD }} \
${{env.REGISTRY}}

- name: Restore Dependencies From Cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}


## 构建,支持domain
- name: Build To Dist
run: ./scripts/bundle build_proxy

- name: Push Docker Image
run: ./scripts/bundle image_faster
39 changes: 0 additions & 39 deletions .github/workflows/code-ci.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/docker-image.yml

This file was deleted.

Loading