Skip to content

v1.25.21 - 2025-12-27 #102

v1.25.21 - 2025-12-27

v1.25.21 - 2025-12-27 #102

# .github/workflows/build-and-publish.yml
#
# Copyright © 2025 Network Pro Strategies (Network Pro™)
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
# This file is part of Network Pro
name: Build and Publish to Registries
on:
release:
types: [created]
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: 'build-and-publish'
cancel-in-progress: true
permissions:
actions: read
contents: read
packages: write
jobs:
check-codeql:
uses: ./.github/workflows/check-codeql.yml
build:
needs: check-codeql
runs-on: ubuntu-24.04
env:
ENV_MODE: ci
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: package-lock.json
- name: Upgrade npm
run: |
corepack enable
npm install -g [email protected]
- name: Install Node.js dependencies
run: npm ci
- name: Install jq
run: sudo apt-get install -y jq
- name: Run npm audit
run: npm audit --audit-level=moderate
continue-on-error: true
- name: Run JSDoc lint check
id: jsdoc_lint
continue-on-error: true
run: |
output=$(npm run lint:jsdoc || true)
echo "$output" | tee jsdoc-lint-output.txt
count=$(echo "$output" | grep -cve '^\s*$')
echo "jsdoc_count=$count" >> "$GITHUB_OUTPUT"
- name: PASS
if: ${{ steps.jsdoc_lint.outputs.jsdoc_count == 0 }}
run: echo "✅ JSDoc lint passed successfully!"
- name: JSDoc violations detected (non-blocking)
if: ${{ steps.jsdoc_lint.outputs.jsdoc_count != 0 }}
run: |
echo "⚠️ JSDoc lint check failed with ${{ steps.jsdoc_lint.outputs.jsdoc_count }} violations (non-blocking)"
echo "--- JSDoc Violations ---"
cat jsdoc-lint-output.txt
- name: Upload JSDoc results
if: ${{ steps.jsdoc_lint.outputs.jsdoc_count != 0 }}
uses: actions/upload-artifact@v6
with:
name: jsdoc-lint-results
path: jsdoc-lint-output.txt
if-no-files-found: error
# Build to ensure the package is functional
- name: Build Node.js project
run: npm run build
# Create Git archive of version-controlled files
- name: Create clean source archive
run: git archive --format=tar.gz --output=clean-source.tar.gz HEAD
- name: Upload source archive
uses: actions/upload-artifact@v6
with:
name: clean-source
path: clean-source.tar.gz
publish-npmjs:
needs: build
runs-on: ubuntu-24.04
env:
ENV_MODE: ci
steps:
- name: Download clean source archive
uses: actions/download-artifact@v7
with:
name: clean-source
path: ./
- name: Extract source archive
run: tar -xzf clean-source.tar.gz
- name: Remove extracted source archive
run: rm clean-source.tar.gz
- name: Set up Node.js for npmjs
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
cache: npm
cache-dependency-path: package-lock.json
- name: Upgrade npm
run: |
corepack enable
npm install -g [email protected]
- name: Install Node.js dependencies
run: npm ci
- name: Set up Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "SunDevil311"
- name: Verify version not already published
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Checking if $PACKAGE_NAME@$PACKAGE_VERSION is already published..."
npm view $PACKAGE_NAME@$PACKAGE_VERSION > /dev/null && {
echo "❌ Version $PACKAGE_VERSION already exists on npm. Exiting..."
exit 1
} || echo "✅ Version is new. Proceeding with publish."
- name: Publish package to npmjs
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_NETPRO }}
publish-gpr:
needs: build
runs-on: ubuntu-24.04
env:
ENV_MODE: ci
steps:
- name: Download clean source archive
uses: actions/download-artifact@v7
with:
name: clean-source
path: ./
- name: Extract source archive
run: tar -xzf clean-source.tar.gz
- name: Remove extracted source archive
run: rm clean-source.tar.gz
- name: Set up Node.js for GPR
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://npm.pkg.github.com/
cache: npm
cache-dependency-path: package-lock.json
- name: Upgrade npm
run: |
corepack enable
npm install -g [email protected]
- name: Install Node.js dependencies
run: npm ci
- name: Set up Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "SunDevil311"
- name: Update package name for GPR
run: |
sed -i 's/"name": "[^"]*"/"name": "@netwk-pro\/web"/' package.json
- name: Verify version not already published
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Checking if $PACKAGE_NAME@$PACKAGE_VERSION is already published..."
npm view $PACKAGE_NAME@$PACKAGE_VERSION > /dev/null && {
echo "❌ Version $PACKAGE_VERSION already exists on npm. Exiting..."
exit 1
} || echo "✅ Version is new. Proceeding with publish."
- name: Publish package to GPR
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}