update ci #33
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: Publish package to npm | ||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| deps: | ||
| name: Install dependencies | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| - name: Cache node_modules | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: dist/ | ||
| key: ${{ runner.os }}-build-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-build- | ||
| - run: pnpm install --frozen-lockfile --prefer-offline | ||
| build: | ||
| name: Build | ||
| needs: [deps] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
| - name: Cache restore node_modules | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| fail-on-cache-miss: true | ||
| path: node_modules/ | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| - name: Build | ||
| run: npm run build | ||
| - name: Cache save build | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: dist/ | ||
| key: ${{ runner.os }}-build-${{ github.sha }} | ||
| test-unit: | ||
| name: Test - Unit | ||
| needs: [deps] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
| - name: Cache restore node_modules | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| fail-on-cache-miss: true | ||
| path: node_modules/ | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| - run: npm run test:unit | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage | ||
| path: coverage/ | ||
| test-integration: | ||
| name: Test - Integration | ||
| uses: ./.github/workflows/shared/base-1.yml | ||
| with: | ||
| command: npm run test:integration | ||
| check-exports: | ||
| name: Check exports | ||
| uses: ./.github/workflows/shared/base-1.yml | ||
| with: | ||
| command: npm run check-exports | ||
| lint: | ||
| name: Lint | ||
| needs: [deps] | ||
| uses: ./.github/workflows/shared/base-2.yml | ||
| with: | ||
| command: npm run lint | ||
| check-format: | ||
| name: Check format | ||
| needs: [deps] | ||
| uses: ./.github/workflows/shared/base-2.yml | ||
| with: | ||
| command: npm run check-format | ||
| check-spelling: | ||
| name: Check spelling | ||
| needs: [deps] | ||
| uses: ./.github/workflows/shared/base-2.yml | ||
| with: | ||
| command: npm run check-spelling | ||
| deploy: | ||
| name: Deploy | ||
| runs-on: ubuntu-latest | ||
| needs: [build, test-unit, test-integration, check-exports, lint] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
| - name: Cache restore build | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| fail-on-cache-miss: true | ||
| path: dist/ | ||
| key: ${{ runner.os }}-build-${{ github.sha }} | ||
| - run: npm pkg delete scripts | ||
| - run: npm pkg delete packageManager | ||
| # - run: npm publish --provenance --access public | ||
| # env: | ||
| # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| artifact: | ||
| name: Artifact | ||
| runs-on: ubuntu-latest | ||
| needs: [build, test-unit, test-integration, check-exports, lint] | ||
| steps: | ||
| - name: Cache restore build | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| fail-on-cache-miss: true | ||
| path: dist/ | ||
| key: ${{ runner.os }}-build-${{ github.sha }} | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build | ||
| path: dist/ | ||