Fix test (#39) #5
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&Publish | |
| on: | |
| push: | |
| branches: [ main ] | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm run test | |
| - if: github.event_name != 'release' | |
| run: | | |
| NPM_PACKAGE_VERSION=`node -e "const fs = require('fs'); console.log(JSON.parse(fs.readFileSync('package.json')).version);"` | |
| SHORT_SHA=`node -e "const sha = \"$GITHUB_SHA\"; console.log(sha.substring(0, 7));"` | |
| npm run build | |
| npm --no-git-tag-version version $NPM_PACKAGE_VERSION-rc.$SHORT_SHA | |
| npm publish --access public --tag dev | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH }} | |
| CI: true | |
| GITHUB_SHA: $${{github.sha}} | |
| - if: github.event_name == 'release' | |
| run: | | |
| npm run build | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH }} | |
| CI: true |