Skip to content

Commit 1538653

Browse files
authored
Merge pull request #52 from dwdcth/v2
优化ci,增加cache,打tag后自动发布demo下的文件
2 parents 7e147e8 + 7df0d75 commit 1538653

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
name: CI
44

5-
# Controls when the action will run.
5+
# Controls when the action will run.
66
on:
77
# Triggers the workflow on push or pull request events but only for the v2 branch
88
push:
99
branches: [ v2 ]
1010
pull_request:
1111
branches: [ v2 ]
12+
create:
13+
tags:
14+
- v*
1215

1316
# Allows you to run this workflow manually from the Actions tab
1417
workflow_dispatch:
@@ -24,16 +27,24 @@ jobs:
2427
steps:
2528
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2629
- uses: actions/checkout@v2
27-
30+
2831
- name: Setup Node.js environment
2932
uses: actions/[email protected]
3033
with:
3134
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
3235
node-version: 14.x
33-
36+
37+
- name: Cache node modules
38+
uses: actions/cache@v2
39+
env:
40+
cache-name: cache-node-modules
41+
with:
42+
path: node_modules
43+
key: ${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
44+
3445
- name: npm install
3546
run: npm install
36-
47+
3748
- name: build
3849
run: npm run build:demo
3950

@@ -45,3 +56,13 @@ jobs:
4556
host: monibuca.com
4657
username: root
4758
privateKey: ${{ secrets.PEM }}
59+
60+
- name: zip
61+
if: startsWith(github.ref, 'refs/tags/')
62+
run: zip -r ./demo.zip demo/public/*
63+
64+
- name: Release
65+
uses: softprops/action-gh-release@v1
66+
if: startsWith(github.ref, 'refs/tags/')
67+
with:
68+
files: "demo.zip"

0 commit comments

Comments
 (0)