diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1b0d0e..f8b9476 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,29 +3,62 @@ name: CI on: [push, pull_request] jobs: + lint: + permissions: + contents: read + pull-requests: read + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + + - name: Cache Node.js modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Install dependencies + run: npm install + + - name: Lint + run: npm run lint + commitlint: - runs-on: ubuntu-22.04 + permissions: + contents: read + pull-requests: read + + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install required dependencies - run: | - apt update - apt install -y sudo - sudo apt install -y git curl - curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - - sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs - - name: Print versions - run: | - git --version - node --version - npm --version - npx commitlint --version - - name: Install commitlint - run: | - npm install conventional-changelog-conventionalcommits - npm install commitlint@latest + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + + - name: Cache Node.js modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node-modules- + + - name: Install dependencies + run: npm install - name: Validate current commit (last commit) with commitlint if: github.event_name == 'push' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11f9e95..0c01a7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,15 +14,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: '20.x' - name: Cache Node.js modules - uses: actions/cache@v3 + id: cache-node-modules + uses: actions/cache@v4 with: path: node_modules key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} @@ -30,7 +31,7 @@ jobs: ${{ runner.os }}-node-modules- - name: Install dependencies - run: npm ci + run: npm install - name: Run Semantic Release run: npx semantic-release diff --git a/eslint.config.js b/eslint.config.js index ec1efcc..1cedfe2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -9,7 +9,7 @@ import prettier from 'eslint-config-prettier'; export default [ { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] }, { languageOptions: { globals: globals.browser } }, - { ignores: ['!.storybook'] }, + { ignores: ['!.storybook', 'dist', '.astro'] }, { settings: { react: { version: 'detect' } } }, pluginJs.configs.recommended, ...typescript.configs.recommended, diff --git a/package.json b/package.json index f5dd417..5a3e977 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "astro build", "build-storybook": "storybook build", "dev": "astro dev", - "lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "lint": "eslint .", "prepare": "husky", "preview": "astro preview", "storybook": "storybook dev -p 6006",