Skip to content

Commit 640e246

Browse files
author
sunss
committed
chore(deploy.yml): 添加GitHub action
1 parent 6dd8d6b commit 640e246

File tree

2 files changed

+46
-9
lines changed

2 files changed

+46
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy CI
2+
3+
on:
4+
release:
5+
types: [published]
6+
branches:
7+
- master
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Get yarn cache directory path
15+
id: yarn-cache-dir-path
16+
run: echo "::set-output name=dir::$(yarn cache dir)"
17+
- name: Cache yarn cache
18+
uses: actions/cache@v2
19+
id: cache-yarn-cache
20+
with:
21+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
22+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
23+
restore-keys: |
24+
${{ runner.os }}-yarn-
25+
- name: Cache node_modules
26+
id: cache-node-modules
27+
uses: actions/cache@v2
28+
with:
29+
path: node_modules
30+
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
33+
- run: yarn --ignore-engines
34+
if: |
35+
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
36+
steps.cache-node-modules.outputs.cache-hit != 'true'
37+
- name: build
38+
run: npm run build
39+
40+
- name: Deploy
41+
uses: peaceiris/actions-gh-pages@v3
42+
with:
43+
deploy_key: ${{ secrets.ACCESS_TOKEN }}
44+
publish_dir: ./dist
45+
force_orphan: true

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
## 开发
44

5-
- **使用 Github1s 在线预览源码**
6-
7-
[![Preview in Github1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/logo.svg)](https://github1s.com/JS-banana/webpack-react-ts/)
8-
95
- **使用 Gitpod 体验在线开发环境**
106

117
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JS-banana/webpack-react-ts/)
@@ -17,10 +13,6 @@
1713
git clone https://github.com/JS-banana/webpack-react-ts
1814

1915
# install
20-
npm install
21-
# pnpm
22-
pnpm install
23-
# or
2416
yarn install
2517

2618
# dev serve
@@ -58,7 +50,7 @@ yarn dev
5850
├── Home // Home模块,建议组件统一大写开头
5951
├── ...
6052
├── App.tsx // react顶层文件
61-
├── index.ts // 项目入口文件
53+
├── index.ts // 项目入口文件
6254
├── typing.d.ts // ts类型文件
6355
├── .editorconfig // IDE格式规范
6456
├── .env // 环境变量

0 commit comments

Comments
 (0)