From bc8ed8fde16afe383a369243db902bcea12edb0e Mon Sep 17 00:00:00 2001 From: boterop Date: Thu, 23 Jan 2025 15:46:58 -0500 Subject: [PATCH 1/3] Publish just relevant files --- .github/workflows/deploy.yml | 9 +++++++-- package.json | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5d158dc..316e657 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,7 +15,12 @@ jobs: with: node-version: '23.x.x' registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm publish + - run: npm run build + - run: | + cd dist + npm ci + - run: | + cd dist + npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 8ab2f9e..ff5159c 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "start": "node --env-file .env --watch src/app.js", "test": "NODE_ENV=test node --experimental-vm-modules --max-old-space-size=8192 node_modules/jest/bin/jest.js --runInBand", + "build": "mkdir -p dist && cp -r src/ dist/ && cp package.json dist/ && cp README.md dist/ && cp LICENSE dist/ && cp CHANGELOG.md dist/ && cd dist && npm i --omit=dev", "format": "prettier --write .", "check-format": "prettier -c .", "lint": "eslint ." From af7d36b3cedd5ad45cbf45d17ee4bea5ff6dc8dd Mon Sep 17 00:00:00 2001 From: boterop Date: Fri, 24 Jan 2025 11:00:47 -0500 Subject: [PATCH 2/3] Testing --- .github/workflows/deploy.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 316e657..f0b0200 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,13 +1,14 @@ name: Publish package to npm + on: - pull_request: + push: branches: - main - types: closed + pull_request: + types: [opened, synchronize, reopened, ready_for_review] jobs: build: - if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -21,6 +22,6 @@ jobs: npm ci - run: | cd dist - npm publish + npm ci env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 87df91303c96cf17d829f6ec74f23c8188a52c7a Mon Sep 17 00:00:00 2001 From: boterop Date: Fri, 24 Jan 2025 11:04:24 -0500 Subject: [PATCH 3/3] Working --- .github/workflows/deploy.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f0b0200..b0e50fe 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,14 +1,13 @@ name: Publish package to npm - on: - push: + pull_request: branches: - main - pull_request: - types: [opened, synchronize, reopened, ready_for_review] + types: closed jobs: build: + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -17,11 +16,13 @@ jobs: node-version: '23.x.x' registry-url: 'https://registry.npmjs.org' - run: npm run build - - run: | + - name: Prepare dist + run: | cd dist npm ci - - run: | + - name: Publish package + run: | cd dist - npm ci + npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}