Skip to content

Commit 985abea

Browse files
authored
feat: Feature to perform npmjs release (#74)
1 parent 8d6b847 commit 985abea

File tree

22 files changed

+77
-57
lines changed

22 files changed

+77
-57
lines changed

.github/workflows/release-github.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,39 +88,47 @@ jobs:
8888
npm run dist
8989
- name: Check if semantic-release created a build
9090
id: check_build
91-
uses: andstor/file-existence-action@v2
91+
uses: actions/github-script@v6
9292
with:
93-
files: './src/sdks/ripple/dist/lib/firebolt-ripple.mjs'
94-
93+
script: |
94+
const fs = require('fs');
95+
const path = './src/sdks/lifecycle-manager/dist/lib/lifecycle-manager.mjs';
96+
return fs.existsSync(path);
97+
- name: File Existence Output
98+
run: |
99+
echo "File exists: ${{ steps.check_build.outputs.result }}"
95100
- name: Get version from package.json
96101
run: |
97102
RELEASE_VERSION=$(node -p "require('./package.json').version")
98103
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
99104
echo "build_cpp_source=true" >> $GITHUB_ENV
100105
- name: Set cpp build source Condition
101-
if: steps.check_build.outputs.files_exists == 'false' || (github.ref_name == 'main' && github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch')
106+
if: steps.check_build.outputs.result == 'false' || (github.ref_name == 'main' && github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch')
102107
run: echo "build_cpp_source=false" >> $GITHUB_ENV
103-
- name: Generate and configure SSH key
108+
- name: Release Firebolt SDKs to NPM
109+
if: steps.check_build.outputs.result == 'true' && github.event_name != 'pull_request' && (github.ref_name != 'main' || github.event_name == 'workflow_dispatch')
110+
env:
111+
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} # <-- Allows semantic-release to publish to npm without 2 factor auth.
104112
run: |
105-
mkdir -p /root/.ssh
106-
echo "${{ secrets.SSH_PRIVATE_KEY }}" > /root/.ssh/id_ed25519
107-
chmod 600 /root/.ssh/id_ed25519
108-
109-
touch /root/.ssh/known_hosts
110-
chmod 644 /root/.ssh/known_hosts
111-
ssh-keyscan github.com >> /root/.ssh/known_hosts
112-
chmod 644 /root/.ssh/known_hosts
113+
npm --version
114+
echo "NPM DIST TAG :: " $NPM_DIST_TAG
115+
npm publish --tag $NPM_DIST_TAG --workspaces --access=public
116+
- name: Dry-run Firebolt SDKs to NPM
117+
if: steps.check_build.outputs.result == 'true' && (github.ref_name == 'main' && github.event_name != 'workflow_dispatch')
118+
env:
119+
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} # <-- Allows semantic-release to publish to npm without 2 factor auth.
120+
run: npm publish --tag $NPM_DIST_TAG --workspaces --dry-run
113121

114122
# - name: Checkout firebolt GitHub.io repository
115-
# if: steps.check_build.outputs.files_exists == 'true'
123+
# if: steps.check_build.outputs.result == 'true'
116124
# env:
117125
# GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches
118126
# PRIVATE_KEY: ${{inputs.PRIVATE_KEY}}
119127
# run: |
120128
# cd /tmp
121-
# git clone git@github.com:rdkcentral/ripple-doc.git ./firebolt-docs
129+
# git clone git@github.com:rdkcentral/lifecycle-manager-doc.git ./firebolt-docs
122130
# - name: Release docs to GitHub.io
123-
# if: steps.check_build.outputs.files_exists == 'true' && (github.ref_name == 'main' || github.ref_name == 'next' || github.ref_name == 'next-major' || github.event_name == 'pull_request')
131+
# if: steps.check_build.outputs.result == 'true' && (github.ref_name == 'main' || github.ref_name == 'next' || github.ref_name == 'next-major' || github.event_name == 'pull_request')
124132
# env:
125133
# GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches
126134
# run: |

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
build/*
22
dist/*
3-
src/sdks/ripple/dist/*
4-
src/sdks/ripple/build/*
5-
src/sdks/ripple/test/transpiled-suite
3+
src/sdks/lifecycle-manager/dist/*
4+
src/sdks/lifecycle-manager/build/*
5+
src/sdks/lifecycle-manager/test/transpiled-suite
66
node_modules/*
77
test/transpiled-suite
88
.DS_Store

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ripple-rpc]
1+
[lifecycle-manager]
22
Copyright 2021 Comcast Cable Communications Management, LLC
33

44
Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
title: Ripple RPC
2+
title: Lifecycle Manager
33
---
4-
Private Ripple RPC API for distributor integration.
4+
Private Lifecycle Manager API for distributor integration.

package-lock.json

Lines changed: 19 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "@firebolt-js/ripple-rpc",
2+
"name": "@firebolt-js/lifecycle-manager",
33
"version": "1.1.0-next.1",
4-
"description": "A Ripple specific RPC definition",
5-
"main": "./dist/lib/ripple-rpc.mjs",
6-
"types": "./dist/lib/ripple-rpc.d.ts",
4+
"description": "A lifecycle-manager specific RPC definition",
5+
"main": "./dist/lib/lifecycle-manager.mjs",
6+
"types": "./dist/lib/lifecycle-manager.d.ts",
77
"type": "module",
88
"workspaces": [
9-
"src/sdks/ripple"
9+
"src/sdks/lifecycle-manager"
1010
],
1111
"scripts": {
1212
"fs:setup": "npm run clean && mkdir -p dist",
@@ -57,6 +57,7 @@
5757
},
5858
"keywords": [
5959
"firebolt",
60+
"lifecycle-manager",
6061
"ripple"
6162
],
6263
"license": "Apache-2.0"

src/js/github.io/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const capabilities = () => {
117117

118118
let manifest = '\n'
119119

120-
const linkify = (method) => `[${method}](./ripple/${method.split('.').shift()}/#${method.match(/\.on[A-Z]/) ? method.split('.').pop().charAt(2).toLowerCase() + method.split('.').pop().substring(3).toLowerCase() : method.split('.').pop().toLowerCase()})`
120+
const linkify = (method) => `[${method}](./lifecycle-manager/${method.split('.').shift()}/#${method.match(/\.on[A-Z]/) ? method.split('.').pop().charAt(2).toLowerCase() + method.split('.').pop().substring(3).toLowerCase() : method.split('.').pop().toLowerCase()})`
121121
Object.keys(capabilities).sort().forEach(c => {
122122
manifest += `### \`${c}\`\n`
123123

src/js/version-specification/apis.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ const run = async (version, parsedArgs) => {
159159
const v = `${legacy}.x`
160160

161161
// create a temporary npm package and install the version of Firebolt we want to grab
162-
await exec(`cd build; mkdir temp${legacy}; cd temp${legacy}; npm init -y ; npm install --saveDev @firebolt-extn-js/ripple-sdk@${v}`)
162+
await exec(`cd build; mkdir temp${legacy}; cd temp${legacy}; npm init -y ; npm install --saveDev @firebolt-js/lifecycle-manager@${v}`)
163163

164-
version.apis[`${legacy}`] = await loadJson(`./build/temp${legacy}/node_modules/@firebolt-extn-js/ripple-sdk/dist/firebolt-open-rpc.json`)
164+
version.apis[`${legacy}`] = await loadJson(`./build/temp${legacy}/node_modules/@firebolt-js/lifecycle-manager/dist/firebolt-open-rpc.json`)
165165
await exec(`cd build; rm -r temp${legacy}`)
166166

167167
logSuccess(`Added version ${v}`)

src/js/version.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ else if (task === 'validate') {
8181
console.log('Finding the latest prerelease')
8282
const prerelease = process.argv.shift()
8383
console.log('prerelease : ' + prerelease)
84-
exec("npm show @firebolt-extn-js/ripple-sdk versions --json", (error, result, errlog) => {
84+
exec("npm show @firebolt-js/lifecycle-manager versions --json", (error, result, errlog) => {
8585
if (error) {
8686
console.error(`error: ${error.message}`);
8787
return;

src/json/firebolt-specification.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"major": 1,
44
"minor": 0,
55
"patch": 0,
6-
"readable": "Ripple SDK"
6+
"readable": "Lifecycle Manager"
77
},
88
"capabilities": {
99
},

0 commit comments

Comments
 (0)