Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
environment: Publish
permissions:
contents: write # required for pushing git tags
id-token: write # required for npm provenance
Expand All @@ -33,7 +34,14 @@ jobs:
run: pnpm format:lint

- name: Test
run: pnpm test
run: pnpm test:coverage

- name: Parse coverage
id: coverage
run: |
PCT=$(node -e "const c=require('./coverage/coverage-summary.json');console.log(Math.round(c.total.lines.pct))")
echo "pct=$PCT" >> $GITHUB_OUTPUT
echo "color=$([ $PCT -ge 80 ] && echo green || [ $PCT -ge 60 ] && echo yellow || echo red)" >> $GITHUB_OUTPUT
Comment thread
rkovalov marked this conversation as resolved.

- name: Build
run: pnpm build
Expand All @@ -53,6 +61,18 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.RSTACKIO_NPM_TOKEN }}

- name: Update coverage badge
if: steps.publish.outputs.published == 'true'
continue-on-error: true
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: ${{ secrets.TEST_COVERAGE_GIST_ID }}
filename: coverage.json
label: coverage
message: ${{ steps.coverage.outputs.pct }}%
color: ${{ steps.coverage.outputs.color }}

- name: Push git tag
if: steps.publish.outputs.published == 'true'
run: |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

[![npm](https://img.shields.io/npm/v/@rstackio/services)](https://www.npmjs.com/package/@rstackio/services)
[![CI](https://github.com/rstackio/services/actions/workflows/publish.yml/badge.svg)](https://github.com/rstackio/services/actions/workflows/publish.yml)
[![coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/rkovalov/c73854c806277dbac2ab2b6936c39518/raw/coverage.json)](https://github.com/rstackio/services/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rstackio/services/blob/main/LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue)](https://www.typescriptlang.org/)

Expand Down