From c910e8751f2523f2f330f93a672107ac7f1014e4 Mon Sep 17 00:00:00 2001 From: "Andrew D.Laptev" Date: Fri, 17 May 2024 12:04:09 +0300 Subject: [PATCH] Coveralls & NPM publish --- .github/workflows/coveralls.yml | 25 +++++++++++++++++++++++++ .github/workflows/npm.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 20 -------------------- README.md | 1 + 4 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/coveralls.yml create mode 100644 .github/workflows/npm.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 0000000..15f0416 --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,25 @@ +on: ["push", "pull_request"] + +name: Test Coveralls + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: npm install, npm test + run: | + npm install + npm run coverage + + - name: Coveralls + uses: coverallsapp/github-action@v2 diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml new file mode 100644 index 0000000..c19d403 --- /dev/null +++ b/.github/workflows/npm.yml @@ -0,0 +1,30 @@ +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 862fee5..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Test -on: [push, pull_request, workflow_dispatch] -jobs: - test: - runs-on: ubuntu-latest - steps: - # Your original steps - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - name: Install - run: npm install - - name: Test and Coverage - run: npm run coverage - - # Add this - - name: Update Coverage Badge - # GitHub actions: default branch variable - # https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable - if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) - uses: we-cli/coverage-badge-action@main diff --git a/README.md b/README.md index 9af31cd..e547b12 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Yet another POP3 library [![Coverage Status](https://coveralls.io/repos/agsh/yapople/badge.svg?branch=master)](https://coveralls.io/r/agsh/yapople?branch=master) +[![NPM version](https://img.shields.io/npm/v/yapople.svg)](https://www.npmjs.com/package/yapople) The design propose of the library is simplicity. A lot of common tasks with you POP3 mailbox doesn't require knowledge of the eleven POP3 commands. You just want to retrieve some messages from your mailbox and that's all! So here is quick