Skip to content

Commit

Permalink
github: set up separate workflow for docs, add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavohenke committed Apr 7, 2023
1 parent ba160e4 commit 334ecd7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/actions/npm-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://github.com/actions/cache/blob/main/examples.md#node---npm
name: Setup NPM cache
runs:
using: composite
steps:
- id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Set up npm cache
uses: ./.github/actions/npm-cache
- name: Install dependencies
run: npm ci
- name: Test
Expand Down Expand Up @@ -48,6 +50,8 @@ jobs:
with:
node-version: 16
cache: npm
- name: Set up npm cache
uses: ./.github/actions/npm-cache
- name: Install dependencies
run: npm ci
- name: Lint
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docs
on:
pull_request:
paths:
- 'docs/**'
- 'website/**'
# Keep the following in sync with website/scripts/regenerate-api.js
- src/options.ts
- src/chain/validators.ts
- src/chain/sanitizers.ts
push:
paths:
- 'docs/**'
- 'website/**'
# Keep the following in sync with website/scripts/regenerate-api.js
- src/options.ts
- src/chain/validators.ts
- src/chain/sanitizers.ts

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- name: Set up npm cache
uses: ./.github/actions/npm-cache
- name: Install dependencies
run: npm ci
- name: Update validator APIs
run: npm run docs:regenerate-api
- name: Verify up-to-date
run: git diff --quiet --exit-code || echo "Docs not up-to-date, please rerun `npm run docs:regenerate-api`"
- name: Build
run: npm run docs:build

0 comments on commit 334ecd7

Please sign in to comment.