Added build action #11
This file contains 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 | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v1 | ||
- run: bun install | ||
- run: bun run build | ||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: oven-sh/setup-bun@v1 | ||
- run: bun install | ||
- run: bun test | ||
publish: | ||
needs: [build, test] | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v1 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Check if version has been updated | ||
id: check | ||
uses: EndBug/version-check@v2 | ||
- run: bun install | ||
if: steps.check.outputs.changed == 'true' | ||
- run: bun run build | ||
if: steps.check.outputs.changed == 'true' | ||
- run: npm publish --access public | ||
if: steps.check.outputs.changed == 'true' | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: 'echo "Package version has not been updated, skipping publish"' | ||
if: steps.check.outputs.changed == 'false' |