Skip to content

Commit

Permalink
fix github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshsusai committed Oct 29, 2024
1 parent d0f1f92 commit e82cc1b
Showing 1 changed file with 84 additions and 5 deletions.
89 changes: 84 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,85 @@
name: CI Pipeline
on: [push]
name: NPM Pipeline

on:
workflow_call: {}
push:
branches:
- "*"
tags:
- "v*"

jobs:
legion-npm-pipeline:
uses: meltwater/legion-github-repos/.github/workflows/legion-npm-package.yml@master
secrets: inherit
Test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: "npm"
registry-url: https://registry.npmjs.org
cache-dependency-path: package-lock.json
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_INSTALL_TOKEN }}

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

Build:
runs-on: ubuntu-latest
needs: Test

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: "npm"
registry-url: https://registry.npmjs.org
cache-dependency-path: package-lock.json
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_INSTALL_TOKEN }}

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build

Publish:
runs-on: ubuntu-latest
needs: Build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: "npm"
registry-url: https://registry.npmjs.org
cache-dependency-path: package-lock.json
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build

- name: Publish package
run: npm publish

0 comments on commit e82cc1b

Please sign in to comment.