Update all dependencies #1127
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: build | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Check package.json is sorted | |
run: npx sort-package-json --check | |
- name: Restore npm dependencies cache | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-npm-cache-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} | |
- name: Install npm dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: ESLint analysis | |
run: npm run eslint | |
- name: Stylelint analysis | |
run: npm run stylelint | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm run test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: unit-tests-${{ matrix.os }} | |
fail_ci_if_error: true | |
- name: Upload build artifact | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@master | |
with: | |
name: build | |
path: ./build | |
deploy: | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore npm dependencies cache | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-npm-cache-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} | |
- name: Install npm dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Download build artifact | |
uses: actions/download-artifact@master | |
with: | |
name: build | |
path: ./build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: ./build | |
release: | |
needs: deploy | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Bump version | |
id: version | |
uses: paulhatch/[email protected] | |
- name: Create GitHub tag and release | |
uses: softprops/[email protected] | |
with: | |
tag_name: ${{ steps.version.outputs.version_tag }} | |
generate_release_notes: true |