Merge pull request #10 from Ecwid/checkout-info-storage #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, run npm lint, build the source code and run tests. | |
name: Build, test and publish API docs | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ '**' ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18.3.0' | |
- name: NPM install | |
run: npm ci | |
- name: Run linter | |
run: npm run lint | |
- name: Build library | |
run: npm run build --if-present | |
- name: Unit tests | |
run: npm test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: npm-logs | |
path: | | |
/home/runner/.npm/_logs | |
publish-api-docs: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Check out | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18.3.0' | |
- name: NPM install | |
run: npm ci | |
- name: Generate API docs | |
run: npm run doc | |
- name: Publish API docs to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.ACCESS_TOKEN }} | |
publish_dir: ./docs |