Skip to content

Commit 754b70d

Browse files
committed
feat: github workflows
1 parent cc6b735 commit 754b70d

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: '10'
15+
- run: npm ci
16+
- run: npm test
17+
- uses: codecov/codecov-action@v2
18+
- run: npm run build
19+
- if: github.ref_name == 'master'
20+
run: |
21+
./script/gh-release.sh
22+
./script/gh-deploy.sh

script/gh-deploy.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
echo "Deploy docs to github pages.";
3+
git checkout --orphan gh-pages;
4+
git reset HEAD -- .;
5+
npm run docs;
6+
git add -f dist/av* docs demo
7+
git config user.name "leancloud-bot";
8+
git config user.email "[email protected]";
9+
git commit -m "Deploy docs and demos to Github Pages [skip ci]";
10+
git push -qf origin gh-pages;
11+
echo "done.";

script/gh-release.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
echo "Deploy dist to dist branch.";
3+
REV=`git rev-parse HEAD`;
4+
BRANCH=`git rev-parse --abbrev-ref HEAD`;
5+
DIST_BRANCH=${1:-dist};
6+
test "$(git config user.name)" = '' && (
7+
git config user.name "leancloud-bot";
8+
git config user.email "[email protected]";
9+
)
10+
git add dist -f;
11+
git commit -m "chore(build): build ${REV} [skip ci]";
12+
git push -qf origin ${BRANCH}:${DIST_BRANCH} > /dev/null 2>&1;
13+
git reset HEAD~1;
14+
echo "done.";

0 commit comments

Comments
 (0)