Skip to content

Commit bdece4d

Browse files
committed
Add the continuous deployment workflow (#188 #228)
1 parent e8430a9 commit bdece4d

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/cd.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This workflow is like CI, but also builds the documentation and deploys to NPM
2+
# and gh-pages.
3+
4+
name: Continuous Deployment
5+
6+
on:
7+
push:
8+
branches: [prepublish]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js 14.x
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 14.x
21+
- name: Configure yarn cache path
22+
run: yarn config set cache-folder ~/.yarn-cache
23+
- name: Restore yarn cache
24+
uses: actions/cache@v2
25+
with:
26+
path: ~/.yarn-cache
27+
key: yarn-cache-14.x
28+
restore-keys: |
29+
yarn-cache-
30+
- name: Restore node_modules
31+
uses: actions/cache@v2
32+
with:
33+
path: node_modules
34+
key: node-modules-14.x-${{ hashFiles('yarn.lock') }}
35+
restore-keys: |
36+
node-modules-14.x-
37+
node-modules-
38+
- name: Install dependencies
39+
run: yarn
40+
- name: Build dist files and docs and run the tests
41+
run: yarn grunt dist docco tocdoc
42+
- name: Commit the build output
43+
uses: EndBug/add-and-commit@v5
44+
with:
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Publish to NPM
48+
run: yarn publish
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
- name: Merge into gh-pages
52+
uses: devmasx/merge-branch@v1.3.0
53+
with:
54+
type: now
55+
target_branch: gh-pages
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
- uses: actions/checkout@v2
58+
with:
59+
ref: gh-pages
60+
- name: Tag the release
61+
uses: Klemensas/action-autotag@stable
62+
with:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
tag_prefix: v

0 commit comments

Comments
 (0)