Add Node build #3
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: Test & Deploy v3 alpha | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - v3 | |
| pull_request: | |
| branches: | |
| - v3 | |
| jobs: | |
| audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: current | |
| - uses: actions/checkout@v4 | |
| - run: npm audit --omit=dev | |
| lint: | |
| needs: [audit] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: current | |
| - uses: actions/checkout@v4 | |
| - run: npm ci | |
| - name: Lint | |
| run: npm run check | |
| test: | |
| needs: [audit] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: ["20", "22"] | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - uses: actions/checkout@v4 | |
| - run: npm ci | |
| - name: Test | |
| run: npm test | |
| deploy: | |
| needs: [lint, test] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: current | |
| - uses: actions/checkout@v4 | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Update @v3-alpha version | |
| run: npm version premajor --no-git-tag-version --preid "alpha.$GITHUB_RUN_NUMBER" | |
| - name: Deploy @v3-alpha version to npm | |
| uses: JS-DevTools/npm-publish@v3 | |
| with: | |
| tag: v3-alpha | |
| token: ${{ secrets.NPM_TOKEN }} |