CI - JavaScript/Typescript/Node Projects #345
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 - JavaScript/Typescript/Node Projects | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'javascript/**' | |
| pull_request: | |
| paths: | |
| - 'javascript/**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: javascript | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: javascript/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: CI | |
| run: npx nx run build-tools-workspace:ci --skip-nx-cache | |
| - name: Check Changesets (PR only) | |
| if: github.event_name == 'pull_request' | |
| run: npx changeset status | |
| release: | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| working-directory: javascript | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| cache-dependency-path: javascript/package-lock.json | |
| - name: Install deps | |
| run: npm ci | |
| - name: Build all packages | |
| run: npx nx run-many -t build --skip-nx-cache | |
| - name: Publish with Changesets | |
| id: publish | |
| run: npx changeset publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |