Skip to content

useEventListener hook #30

useEventListener hook

useEventListener hook #30

Workflow file for this run

name: Node.js CI
on: [push, pull_request]
env:
NODE_VERSION: 20.x
jobs:
test:
if: contains(github.ref, 'refs/tags/') == false
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
cache: npm
node-version: ${{ matrix.node-version }}
- name: Update npm
run: npm install -g npm
- name: Install packages
run: npm ci
- name: Test
run: npm run test
publish-dev:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/trunk'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Update npm
run: npm install -g npm
- name: Install packages
run: npm ci
- name: Read version info
id: info
run: |
PKG_VERSION=`cat package.json | jq -r .version`
COMMIT_HASH=`git rev-parse --short HEAD`
echo "pkg_version=${PKG_VERSION}" >> $GITHUB_OUTPUT
echo "hash=${COMMIT_HASH}" >> $GITHUB_OUTPUT
- name: Edit version
run: npm --ignore-scripts --no-git-tag-version version ${{ steps.info.outputs.pkg_version }}-dev-${{ steps.info.outputs.hash }}
- name: Publish to NPM
run: npm publish --access=public --tag=dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}