Skip to content

Commit

Permalink
pull build pipeline changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshsusai committed Oct 16, 2024
2 parents 8cc3030 + 34acbf7 commit 5c41805
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 111 deletions.
File renamed without changes.
23 changes: 23 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Node.js CI test

on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm test
74 changes: 74 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish

on:
workflow_run:
workflows: ["Node.js CI test"]
types:
- completed
push:
tags:
- "v*"

jobs:
Publish:
runs-on: ubuntu-latest
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: Publish package
run: npm publish

- name: Build package
run: |
sudo apt-get update
sudo apt-get install -y ruby-dev build-essential rpm
sudo gem install fpm
sudo scripts/build-packages
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "*.deb,*.rpm"
name: ${{ github.ref_name }}
tag: ${{ github.ref }}

Deploy_Docker_Image:
runs-on: ubuntu-latest
needs: Publish
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: Build and Deploy Docker Image
run: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo scripts/deploy-docker
sudo docker logout
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
docker/
scripts/

.github
.drone.yml
.editorconfig
.eslintrc
Expand Down
Loading

0 comments on commit 5c41805

Please sign in to comment.