diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ba68e25..31019203 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - '**' + jobs: build: name: npm test @@ -11,15 +12,18 @@ jobs: strategy: fail-fast: false matrix: - node_version: [18.x, 20.x] + node_version: [22.x, 20.x] os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + + - name: Use Node.js ${{ matrix.node_version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node_version }} + - run: npm install + - run: npm test env: CI: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..008c3367 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release to NPM +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' # Matches semantic version tags like 1.2.3 + +jobs: + release: + name: Publish to NPM + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.x + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + env: + CI: true + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} \ No newline at end of file