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
39 changes: 39 additions & 0 deletions .github/workflows/publish-sb-dashlets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish sb-dashlets Package

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18.19.0'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 18 ?


- name: Restore Yarn cache
id: cache
uses: actions/cache@v4
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-cache-

- name: Install dependencies
run: yarn install

- name: Build and Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm run build-lib
npm pack ./dist/sb-dashlets
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
npm publish ./dist/sb-dashlets
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,34 @@ npm link @project-sunbird/sb-dashlet
| 8.0.0_v15 | 8.0.0 | Ng V15 |
| 8.0.0_v16 | 8.0.2 | Ng V16 |

#### Code Quality

The project maintains code quality through automated checks that run on every pull request:

1. **Linting**
- Runs ESLint to check code style and quality
- Command: `yarn lint`

2. **Dependencies**
- Uses `yarn install` for deterministic installations
- GitHub Actions cache for faster builds

3. **Testing**
- Unit tests using Karma
- Command: `yarn test`

These checks ensure consistent code style and secure dependency management.

## Package Publishing

Workflow automatically builds and publishes NPM packages whenever a new tag is pushed to the repository.

### Publish Workflow

The workflow is triggered on:
- Push events for any Git tag

Key features of the workflow:
1. Automatically builds the project
2. Creates NPM package
3. Publishes to NPM registry using NPM authentication token (must be provided as GitHub secret `NPM_TOKEN`)
2 changes: 1 addition & 1 deletion projects/sb-dashlets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@project-sunbird/sb-dashlet",
"version": "8.0.2",
"version": "8.0.3",
"repository": {
"type": "git",
"url": "git+https://github.com/Sunbird-Ed/sb-dashlets.git"
Expand Down
Loading