Selective heading levels #179
Workflow file for this run
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: Test & Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: current | |
- uses: actions/checkout@v3 | |
- run: npm audit --omit=dev | |
test: | |
needs: [ audit ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ '14', '16', '18' ] | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/checkout@v3 | |
- run: npm ci | |
- name: Test | |
run: npm test | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
retention-days: 7 | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos | |
retention-days: 7 | |
deploy: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: current | |
- uses: actions/checkout@v3 | |
- run: npm ci | |
- name: Deploy @latest version to npm | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
- name: Update @next version | |
if: startsWith(github.ref, 'refs/heads/') | |
run: npm version prerelease --no-git-tag-version --preid "$GITHUB_RUN_NUMBER" | |
- name: Deploy @next version to npm | |
if: startsWith(github.ref, 'refs/heads/') | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
tag: next | |
token: ${{ secrets.NPM_TOKEN }} | |
check-version: false |