name: 'CI' on: push: branches: - main tags: - '**' pull_request: branches: - '**' jobs: lint: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] node: ['20'] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'npm' - run: npm ci - run: npm run lint test: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] node: ['20', '22'] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'npm' - run: npm ci - run: npm test - uses: actions/upload-artifact@v3 if: matrix.os == 'ubuntu-latest' && matrix.node == '20' with: name: coverage-${{ matrix.os }}-${{ matrix.node }} path: coverage/ build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] node: ['20', '22'] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'npm' - run: npm ci - run: npm run build coverage: runs-on: ubuntu-latest needs: [test] if: ${{ success() && github.actor != 'dependabot[bot]' }} steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v3 with: name: coverage-ubuntu-latest-20 - uses: paambaati/codeclimate-action@v5.0.0 env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} publish: needs: [lint, test, build] if: success() && startsWith(github.ref, 'refs/tags') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: registry-url: 'https://registry.npmjs.org' - run: npm ci - run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}