Skip to content

Commit

Permalink
feat: Release V2.1.0 (#105)
Browse files Browse the repository at this point in the history
* docs: update readme

* fix: broken pre-commit hook

* docs: update readme

* docs: update readme

* chore: update docs

* docs: update readme

* docs: fix bullet points

* build: migrate org scope

* ci(workflow): migrate org scope

* refactor: use new org imports

* 2.3.0-rc.0

* chore(deps): bump nats from 2.28.0 to 2.28.2

Bumps [nats](https://github.com/nats-io/nats.js) from 2.28.0 to 2.28.2.
- [Release notes](https://github.com/nats-io/nats.js/releases)
- [Changelog](https://github.com/nats-io/nats.js/blob/main/Releases.md)
- [Commits](https://github.com/nats-io/nats.js/commits)

---
updated-dependencies:
- dependency-name: nats
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat: variable validation

* test: mock startup type

* 2.3.0-rc.1

* fix: cater for optional vars

* 2.3.0-rc.2

* Add Tazama info to LICENSE file

* fix: manifest

* refactor: bump central library

* fix: use new dir for validation config

* refactor: bump lib version

* feat: Bumped Version

* feat: relay services

* feat: impl Relay Service

* feat(nats): allow opting out of message decoding

* revert: opt out of decode

* fix: set types as dev dep

* refactor: reuse setlogger func

* docs: update readme

* build: update lockfile

* fix: set frms-coe-startup-lib package to be public in the package.json to avoid unauthenticated errors during installations. (#129)

* build: Add npm publish workflow (#133)

* feat: Update publish.yml

* feat: Update publish.yml

* feat: Update publish.yml

* feat: Update publish.yml

* feat: Update publish.yml

* feat: Update publish.yml

* feat: Update publish.yml

* feat: Update publish.yml

* feat: publish to remove rc tag before release

* feat: update publish workflow scope

* feat: use default actions token to publish

* feat: fix token

* feat: fix token

* feat: publish to remove rc tag before release

* feat: publish to remove rc tag before release

* feat: fix token

* feat: fix token

* feat: publish with token that has write access

* feat: publish with token that has write access

* feat: publish with token that has write access

* feat: use one job env-var across all steps

* feat: use one job env-var across all steps

* feat: use one job env-var across all steps

* feat: fix yaml syntax

* feat: generate and use new token scoped to startup lib

* feat: test e2e with pr creation

* chore: Bump version after publishing to Github NPM (#134)

* feat: Update startup-lib after using coe-lib 5.0.0

* fix: Lib/update (#136)

* build: update libs

* 2.3.0

---------

Co-authored-by: rtkay123 <rodney.kanjala@sybrin.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Justus Ortlepp <123470803+Justus-at-Tazama@users.noreply.github.com>
Co-authored-by: rtkay123 <rodney.kanjala@sybrin.com>
Co-authored-by: rtkay123 <70331483+rtkay123@users.noreply.github.com>
Co-authored-by: Len Bekker <len.bekker@sybrin.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lee Ivy <leeivyca@gmail.com>
Co-authored-by: Sandy Labuschagne <slabuschagne@contractor.linuxfoundation.org>
Co-authored-by: cshezi <cshezi@sybrin.co.za>
Co-authored-by: Cebolenkosi Shezi <131665740+cshezi@users.noreply.github.com>
Co-authored-by: Jean-Pierre <Jean-Pierre.NelL@Sybrin.com>
Co-authored-by: Jean-Pierre Nell <48053940+JeanPierreNell@users.noreply.github.com>
  • Loading branch information
12 people authored Dec 9, 2024
1 parent 7df12c6 commit 8e04899
Show file tree
Hide file tree
Showing 20 changed files with 1,738 additions and 1,047 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
# Defaults to the user or organization that owns the workflow file
scope: '@frmscoe'
scope: '@tazama-lf'

- name: Install dependencies
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
# Defaults to the user or organization that owns the workflow file
scope: '@frmscoe'
scope: '@tazama-lf'
- name: Install dependencies
run: npm ci
env:
Expand Down
159 changes: 159 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# SPDX-License-Identifier: Apache-2.0

name: Publish dev npm package to GitHub

on:
push:
branches:
- 'dev'
paths-ignore:
- package.json
- package-lock.json
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest
env:
GH_TOKEN: '${{ secrets.FRMS_COE_STARTUP }}'
permissions:
packages: write
contents: read

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

- name: Setup Node.js (.npmrc)
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
# Defaults to the user or organization that owns the workflow file
scope: '@tazama-lf'

- name: Set up NPM authentication
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.FRMS_COE_STARTUP }}" > ~/.npmrc
cat .npmrc
- name: Configure Git
run: |
git config user.email ${{ secrets.GH_EMAIL }}
git config user.name ${{ secrets.GH_USERNAME }}
- name: Version bumping
env:
GH_TOKEN: '${{ secrets.FRMS_COE_STARTUP }}'
run: |
commit_message=$(git log -1 --pretty=%B)
echo "Commit message: $commit_message"
if [[ "$commit_message" == *'feat!:'* ]]; then
npm version major
elif [[ "$commit_message" == *"feat:"* ]]; then
npm version minor
else
npm version prerelease --preid=rc
fi
- name: Install dependencies
run: npm ci

- name: Build library
run: npm run build

- name: Publish package
env:
GH_TOKEN: ${{ secrets.FRMS_COE_STARTUP }}
run: |
npm publish
- name: Capture Version
id: capture_version
run: |
export version=$(jq -r '.version' package.json)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Push Changes in package.json and make PRs
run: |
export GH_USERNAME=${{ secrets.GH_USERNAME }}
export GH_TOKEN=${{ secrets.FRMS_COE_STARTUP }}
git config --global user.name ${{ secrets.GH_USERNAME }}
# Clear the GITHUB_TOKEN environment variable and use a temporary file for gh authentication
echo "${{ secrets.FRMS_COE_STARTUP }}" > /tmp/gh_token
unset GITHUB_TOKEN
unset GH_TOKEN
gh auth login --with-token < /tmp/gh_token
git clone https://${{ secrets.GH_USERNAME }}:${{ secrets.FRMS_COE_STARTUP }}@github.com/${{ github.repository }}.git
REPO_NAME=$(basename -s .git https://github.com/${{ github.repository }}.git)
cd $REPO_NAME
echo "Currently in repository directory: $(pwd)"
if git ls-remote --heads origin version-bump | grep version-bump; then
# Branch exists, pull the latest changes
git checkout version-bump
git pull origin version-bump
else
# Branch does not exist, create it
git checkout -b version-bump
fi
git config --global user.email ${{ secrets.GH_EMAIL }}
git config --global user.name ${{ secrets.GH_USERNAME }}
# print current version
sed -i 's/"version": "[^"]*"/"version": "'"${{ env.VERSION }}"'"/' package.json
cat package.json
git add .
git commit -m "chore: Bump version after publishing to Github NPM" || echo "No changes to commit"
git push origin version-bump || git push origin version-bump --force
gh pr create --title "build: Automated PR; Bump version after publishing to Github NPM" --body "This pull request updates the version in the `package.json` and `package-lock.json` after the package was published." --base dev --head version-bump --assignee ${{ secrets.GH_USERNAME }} --label build || echo "PR already exists, updating existing PR"
PR_ID=$(gh pr view --json number -q ".number")
echo "PR_ID=$pr_id" >> $GITHUB_ENV
# Cleanup
rm /tmp/gh_token
# Send Slack Notification
- name: Send Slack Notification
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
# Fetch the PR ID from the environment
PR_ID=${{ env.PR_ID }}
curl -X POST -H 'Content-type: application/json' --data '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New NPM GitHub package published :white_check_mark:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Github Repository:*\nhttps://github.com/${{ github.repository }}"
},
{
"type": "mrkdwn",
"text": "*Pull Requests:*\n<https://github.com/${{ github.repository }}/pull/${{ steps.capture_pr.outputs.PR_ID }}|List${{ steps.capture_pr.outputs.PR_ID }}>"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Please head over to the github repository and merge the PR linked above to update the `package.json` with the newly published npm package."
}
}
]
}' $SLACK_WEBHOOK_URL
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
node-version: 20.x
registry-url: https://npm.pkg.github.com/
scope: '@frmscoe'
scope: '@tazama-lf'

# Install dependencies
- name: Install dependencies
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
npm run build
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

@frmscoe:registry=https://npm.pkg.github.com
@tazama-lf:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GH_TOKEN}
13 changes: 1 addition & 12 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,7 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright [2024] [Tazama]

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

0 comments on commit 8e04899

Please sign in to comment.