lint #20
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: ["master"] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["master"] | |
| jobs: | |
| lint: | |
| name: ESLint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install Packages | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npm run lint | |
| test: | |
| name: Jest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install Packages | |
| run: npm ci | |
| - name: Run Jest | |
| run: npm test | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Update npm to latest | |
| run: npm install -g npm@latest | |
| - name: Install Packages | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true |