From ea676f91ef27874066600c521242859d8f3b50cb Mon Sep 17 00:00:00 2001 From: Markus Berg Date: Thu, 15 Feb 2024 17:02:07 +0100 Subject: [PATCH] ci: add version to code coverage badge --- .github/workflows/master.yaml | 15 ++++++++++++--- README.md | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 2f7908a..2319c89 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -22,8 +22,17 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm ci - - run: npm run build --if-present - - run: npm test + - run: npm run build + - run: npm run test + + - name: Get npm version + id: get-values + shell: bash + run: | + VERSION=$(node -p 't=require(`./package.json`).version') + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - name: Update Coverage Badge - uses: we-cli/coverage-badge-action@main + uses: markusberg/coverage-badge-action@main + with: + version: ${{ format('-{0}', steps.get-values.outputs.VERSION) }} diff --git a/README.md b/README.md index ecba93e..57dfd93 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ltpa [![node.js build](https://github.com/markusberg/ltpa/actions/workflows/master.yaml/badge.svg)](https://github.com/markusberg/ltpa/actions/workflows/master.yaml) -[![coverage](https://markusberg.github.io/ltpa/badges/coverage.svg)](https://github.com/markusberg/ltpa/actions) +[![coverage](https://markusberg.github.io/ltpa/badges/coverage-2.0.0-alpha.1.svg)](https://github.com/markusberg/ltpa/actions) [![version](https://img.shields.io/npm/v/ltpa.svg)](https://codecov.io/github/markusberg/ltpa) [![license](https://img.shields.io/github/license/markusberg/ltpa.svg)](https://www.apache.org/licenses/LICENSE-2.0)