-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
7df12c6
commit 8e04899
Showing
20 changed files
with
1,738 additions
and
1,047 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.