chore: switch to pnpm #9
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
name: CICD | |
on: | |
push: | |
branches: | |
master | |
pull_request: | |
env: | |
NODE_VERSION: 14 | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
name: Setup | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
id: node-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
id: yarn-cache-restore | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
if: steps.yarn-cache-restore.outputs.cache-hit != 'true' | |
run: yarn | |
lint: | |
runs-on: ubuntu-latest | |
name: Lint | |
needs: setup | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
id: node-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache-restore | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Lint | |
run: | | |
yarn lint | |
test: | |
runs-on: ubuntu-latest | |
name: Test | |
needs: setup | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
id: node-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache-restore | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Tests | |
run: | | |
yarn coverage | |
- name: Coverage upload | |
run: | | |
yarn coverage-upload | |
build: | |
runs-on: ubuntu-latest | |
name: Build | |
needs: setup | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
id: node-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache-restore | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true' | |
run: yarn | |
- run: | | |
yarn build | |
- name: Build Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-artifacts | |
path: dist | |
release: | |
runs-on: ubuntu-latest | |
name: Release | |
needs: | |
- build | |
- test | |
- lint | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
id: node-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache-restore | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
- name: Build Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-artifacts | |
path: dist | |
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Release (dry) | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: | | |
yarn semantic-release --ci --dry-run | |
- name: Release | |
if: ${{ github.ref == 'refs/heads/master' }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
yarn semantic-release --ci | |
website-deploy: | |
runs-on: ubuntu-latest | |
name: Website deploy | |
needs: setup | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
id: node-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache-restore | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Deploy (dry) | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: | | |
yarn website:dryrun | |
- name: Deploy | |
if: ${{ github.ref == 'refs/heads/master' }} | |
env: | |
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | |
run: | | |
yarn website:deploy |