Update package.json #14
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: Node.js CI + Publish | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| # Only publish on version bumps (if package.json version changed) | |
| paths: | |
| - 'package.json' | |
| - 'app.js' | |
| - 'Readme.md' | |
| jobs: | |
| # Name can be anything | |
| build-and-publish: | |
| runs-on: ubuntu-latest # It means Github creates VM and there all this workflow will run | |
| strategy: | |
| matrix: | |
| node-version: [18.x] | |
| steps: | |
| - name: Clone the repo on Ubuntu VM on GitHub # Clone this repo on that VM | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} # setup node js on VM | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| registry-url: 'https://registry.npmjs.org/' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Check versions | |
| run: | | |
| npm -v | |
| node -v | |
| - name: Build (if applicable) | |
| run: npm run build --if-present | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |