test #18
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: Build and Publish | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm i | |
| - name: Run TypeScript compilation | |
| run: | | |
| npm install typescript | |
| npx tsc | |
| - name: Update version (patch) | |
| run: | | |
| git config user.email "you@example.com" | |
| git config user.name "you" | |
| git add . | |
| git commit -m "chore: update build" | |
| npm version patch | |
| git add . | |
| git commit -m "chore: update build" | |
| git push | |
| - name: Publish to NPM | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPMJS_API_TOKEN }} |