Skip to content

Commit

Permalink
Merge branch 'main' into 2024-01-31-scope-prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
cd-rite committed Mar 6, 2024
2 parents dd68147 + 6fa33bf commit b2d75ac
Show file tree
Hide file tree
Showing 23 changed files with 2,732 additions and 1,076 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build-binary-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and Sign Binary Artifacts
on:
release:
types: [published]
workflow_dispatch:
push:
branches:
- main
paths:
- "lib/**"
- "index.js"
- "build.sh"
- "nuwcdivnpt-bot.gpg.asc"
- ".github/workflows/build-binary-artifacts.yml"
jobs:
build-binary-artifacts-and-sign:
name: Build binary artifacts, sign, export
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0

- name: run build script
id: run_build_script
run: ./build.sh

- name: Import GPG Key
id: import_gpg
run: |
if ! echo "${{ secrets.WATCHER_PRIVATE_KEY }}" | gpg --import; then
echo "::warning ::Private key GPG Import failed"
exit 1
fi
- name: Get version from package.json
id: package_version
run: echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV

- name: Sign Artifacts
id: sign_artifacts
run: |
if ! gpg --default-key [email protected] --armor --detach-sig ./dist/stigman-watcher-linux-${{ env.PACKAGE_VERSION }}.tar.gz; then
echo "::warning ::Linux Signing failed"
exit 1
fi
if ! gpg --default-key [email protected] --armor --detach-sig ./dist/stigman-watcher-win-${{ env.PACKAGE_VERSION }}.zip; then
echo "::warning ::Windows Signing failed"
exit 1
fi
- name: Verify Signatures
id: verify_signatures
working-directory: ./dist
run: |
if ! gpg --verify stigman-watcher-linux-${{ env.PACKAGE_VERSION }}.tar.gz.asc stigman-watcher-linux-${{ env.PACKAGE_VERSION }}.tar.gz; then
echo "::warning ::Signature verification for Linux failed"
exit 1
fi
if ! gpg --verify stigman-watcher-win-${{ env.PACKAGE_VERSION }}.zip.asc stigman-watcher-win-${{ env.PACKAGE_VERSION }}.zip; then
echo "::warning ::Signature verification for Windows failed"
exit 1
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: binary-artifacts
path: |
./dist/
if-no-files-found: error
24 changes: 24 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Package to npmjs
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
# Defaults to the user or organization that owns the workflow file
scope: '@nuwcdivnpt'
- run: npm ci
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
-Dsonar.projectName=NUWCDIVNPT_stigman-watcher
-Dsonar.organization=nuwcdivnpt
-Dsonar.inclusions=**/*.js
-Dsonar.exclusions=**/node_modules/**,
-Dsonar.exclusions=**/node_modules/**,**/test/**,**/coverage/**


# This will fail the action if Quality Gate fails (leaving out for now )
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/unit-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Unit Tests and Upload Coverage Artifact
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "lib/**"
- "index.js"
- "test/**"
pull_request:
branches:
- main
paths:
- "lib/**"
- "index.js"
- "test/**"

jobs:
build_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install app dependencies
run: npm ci
- name: Create .env file
run: echo -e "WATCHER_COLLECTION=1\nWATCHER_API_BASE=url\nWATCHER_AUTHORITY=auth\nWATCHER_CLIENT_ID=clientId\nWATCHER_CLIENT_SECRET=secret" > .env
- name: Run tests
run: npm test
- name: Upload coverage to github
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: coverage
path: coverage
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ watched/
.vscode/
.env
*.log
log.json
log.json
bundle.js
coverage/
Loading

0 comments on commit b2d75ac

Please sign in to comment.