From fc4be74804acae83639020ff307289c3f10352f0 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:13:55 +0100 Subject: [PATCH] chore: add github workflows Adds a ci and publish workflow. --- .github/FUNDING.yml | 1 + .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++++ .github/workflows/publish.yml | 38 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8bf5ae0 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +open_collective: chaijs \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d5b017a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build: + name: Test on node ${{ matrix.node-version }} + runs-on: ubuntu-latest + strategy: + matrix: + node-version: + - 18 + - 20 + - latest + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run lint + - run: npm run build --if-present + - run: npm run test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..12b70d8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,38 @@ +name: Publish to npm + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: npm ci + - run: npm run build --if-present + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22.x + registry-url: "https://registry.npmjs.org" + cache: "npm" + - run: npm ci + - run: npm run build --if-present + - run: npm version ${TAG_NAME} --git-tag-version=false + env: + TAG_NAME: ${{ github.ref_name }} + - run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.npm_secret }} diff --git a/package.json b/package.json index f47552a..a7fcc86 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pathval", "description": "Object value retrieval given a string path", "homepage": "https://github.com/chaijs/pathval", - "version": "2.0.0", + "version": "0.0.0-dev", "keywords": [ "pathval", "value retrieval",