From 3d64d097bc3b3b3c7a6edfa1e7f9d4120a3c0a12 Mon Sep 17 00:00:00 2001 From: Miguel Cruces Date: Mon, 15 Jun 2026 12:48:55 +0200 Subject: [PATCH 1/2] feat: CI & CD --- .github/workflows/ci.yaml | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..991f9f2 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,62 @@ +name: Build, Test, and Publish to NPM + +on: + push: + branches: + - '**' + tags: + - '*' + pull_request: + branches: + - '**' + +jobs: + # 1. Test Job: Runs on all pushes and PRs + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + # 2. Release Job: Only runs on tags, after tests pass + build-and-release: + needs: test # Ensures tests pass before attempting to release + if: startsWith(github.ref, 'refs/tags/') # Only runs on tag pushes + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get Tag name + id: vars + run: echo "TAG_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file From 9cf5eee58679a3bfdb27930fed7a2880b5543433 Mon Sep 17 00:00:00 2001 From: Miguel Cruces Date: Mon, 15 Jun 2026 12:53:32 +0200 Subject: [PATCH 2/2] fix(ci): Build before running tests --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 991f9f2..8f179ee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,6 +27,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Build project + run: npm run build + - name: Run tests run: npm test