Skip to content

Commit

Permalink
chore(ci): setup Solo for npm publishing (#724)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Klick <[email protected]>
  • Loading branch information
nathanklick authored Feb 1, 2024
1 parent 2bbcdd2 commit a702e27
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 65 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/flow-deploy-release-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Calculate Next Version
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
Expand Down Expand Up @@ -252,17 +252,33 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
with:
gradle-version: wrapper
gradle-home-cache-includes: |
caches
notifications
dependency-check-data
gradle-version: ${{ github.event.inputs.gradle-version || 'wrapper' }}

- name: Setup Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 18

- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@8fc3d0018a8721b9a797cd7fd97c8e4833f5a3d1 # v3.5.3
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}

- name: Show JFrog Config
run: jfrog config show

- name: Verify JFrog Connectivity
run: jfrog rt ping

- name: Setup JFrog NPM Repository
working-directory: solo
run: |
jf npmc --server-id-resolve setup-jfrog-cli-server --server-id-deploy setup-jfrog-cli-server --repo-resolve solo-npm-release --repo-deploy solo-npm-release
echo "::group::JFrog NPM Repository Configuration"
cat .jfrog/projects/npm.yaml
echo "::endgroup::"
- name: Install Semantic Release
run: |
npm install -g [email protected] @semantic-release/[email protected] @semantic-release/[email protected] [email protected]
Expand All @@ -271,19 +287,24 @@ jobs:
- name: Install Dependencies
working-directory: solo
run: npm ci
run: jf npm ci

- name: Deploy to JFrog Registry
working-directory: solo
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }}
run: jf npm publish

- name: Setup NPM Authentication
working-directory: solo
run: |
# create .npmrc file to publish solo to Github NPM registry
rm -f .npmrc || true
echo '//npm.pkg.github.com/:_authToken=${NPM_TOKEN}' > ".npmrc"
echo '@hashgraph:registry=https://npm.pkg.github.com' >> ".npmrc"
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ".npmrc"
echo '@hashgraph:registry=https://registry.npmjs.org/' >> ".npmrc"
- name: Publish Semantic Release
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/zxc-release-maven-central.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ jobs:
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
with:
gradle-version: ${{ inputs.gradle-version }}
gradle-home-cache-includes: |
caches
notifications
dependency-check-data

# This step is used to update the version number in the build.properties file.
- name: Apply Version Number Update (Explicit)
Expand Down
8 changes: 4 additions & 4 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[
"@semantic-release/npm",
{
"pkgRoot": "fullstack-network-manager"
"pkgRoot": "solo"
}
],
"@semantic-release/git",
Expand All @@ -30,7 +30,7 @@
[
"@semantic-release/npm",
{
"pkgRoot": "fullstack-network-manager"
"pkgRoot": "solo"
}
],
[
Expand All @@ -40,8 +40,8 @@
"gradle.properties",
"charts/fullstack-deployment/Chart.yaml",
"charts/fullstack-cluster-setup/Chart.yaml",
"fullstack-network-manager/package.json",
"fullstack-network-manager/package-lock.json"
"solo/package.json",
"solo/package-lock.json"
]
}
]
Expand Down
4 changes: 2 additions & 2 deletions build-logic/project-plugins/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class Utils {
}

@JvmStatic
fun updateFullstackNetworkManagerVersion(project: Project, newVersion: SemVer) {
val manifestFile = File(project.rootProject.projectDir, "fullstack-network-manager/package.json")
fun updateSoloVersion(project: Project, newVersion: SemVer) {
val manifestFile = File(project.rootProject.projectDir, "solo/package.json")
updateStringInFile(manifestFile, "\"version\":", " \"version\": \"${newVersion}\",")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ tasks.register("versionAsSpecified") {
val newVer = SemVer.parse(verStr)
Utils.updateHelmChartVersion(project, newVer)
Utils.updateHelmChartAppVersion(project, newVer)
Utils.updateFullstackNetworkManagerVersion(project, newVer)
Utils.updateSoloVersion(project, newVer)
Utils.updateVersion(project, newVer)
}
}
Expand All @@ -73,7 +73,7 @@ tasks.register("versionAsSnapshot") {

Utils.updateHelmChartVersion(project, newVer)
Utils.updateHelmChartAppVersion(project, newVer)
Utils.updateFullstackNetworkManagerVersion(project, newVer)
Utils.updateSoloVersion(project, newVer)
Utils.updateVersion(project, newVer)
}
}
Expand Down
20 changes: 0 additions & 20 deletions package-lock.json

This file was deleted.

5 changes: 0 additions & 5 deletions package.json

This file was deleted.

13 changes: 1 addition & 12 deletions solo/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
# Solo

Solo is a CLI tool to manage and deploy a private Hedera Network.
An opinionated CLI tool to deploy and manage private Hedera Networks.

## Install

* Create or update `~/.npmrc` file and specify the GitHub package registry:

```
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@hashgraph:registry=https://npm.pkg.github.com
```

* Get
your [Github access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)
and setup an environment variable GITHUB\_TOKEN.

* Run `npm install -g @hashgraph/solo`

* Ensure you have a valid kubernetes context, cluster and namespace. You may use `kind` and `kubectl` CLIs to create
Expand Down
8 changes: 2 additions & 6 deletions solo/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
"name": "@hashgraph/solo",
"version": "0.18.0",
"description": "Solo is a CLI tool to manage and deploy a private Hedera Network.",
"description": "An opinionated CLI tool to deploy and manage private Hedera Networks.",
"main": "src/index.mjs",
"type": "module",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"bin": {
"solo": "solo.mjs"
},
Expand Down Expand Up @@ -58,8 +55,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hashgraph/solo.git",
"directory": "solo"
"url": "git+https://github.com/hashgraph/solo.git"
},
"os": [
"darwin",
Expand Down

0 comments on commit a702e27

Please sign in to comment.