shareon/.github/workflows/ci.yml

64 lines
1.4 KiB
YAML

name: Node.js CI
on:
push:
branches:
- main
- v*
pull_request:
branches:
- main
jobs:
lint:
name: Lint package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "16"
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
- name: Install dependencies
run: pnpm i
- name: Lint
run: pnpm run lint
build-docs:
name: Build and test package and deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "16"
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
- name: Install dependencies
run: pnpm i
- name: Test package
run: pnpm run test
- name: Copy built files to docs
run: cp ./dist/shareon.min.* ./docs
if: ${{ github.ref == 'refs/heads/main' }}
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2
with:
keep_history: true
build_dir: docs
fqdn: shareon.js.org
jekyll: false
if: ${{ github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}