Skip to content

Publish to Registries #1

Publish to Registries

Publish to Registries #1

Workflow file for this run

# .github/workflows/publish.yml
#
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
# This file is part of Network Pro
name: Publish to Registries
on:
workflow_run:
workflows: ["Build Site and Deploy to GH Pages"]
types:
- completed
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm # This handles caching ~/.npm based on package.json
- name: Install Node.js dependencies
run: npm ci
# MkDocs Integration
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install MkDocs and plugins
run: |
pip install mkdocs mkdocs-material mkdocs-material-extensions mkdocs-get-deps mkdocs-rss-plugin
- name: Build MkDocs documentation
run: mkdocs build
- name: Copy package.json and README.md to build directory
run: cp package.json README.md build/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: build/
publish-npm:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build/
- name: Set up Node.js for npmjs
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
- name: Set up Git user
run: |
git config --global user.email "github@sl.neteng.cc"
git config --global user.name "SunDevil311"
- name: Publish package to npmjs
working-directory: ./build
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_NETPRO }}
publish-gpr:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build/
- name: Set up Node.js for GPR
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://npm.pkg.github.com/
- name: Set up Git user
run: |
git config --global user.email "github@sl.neteng.cc"
git config --global user.name "SunDevil311"
- name: Update package name for GPR
run: |
sed -i 's/"name": ".*"/"name": "@netwk-pro\/docs"/' build/package.json
- name: Publish package to GPR
working-directory: ./build
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PAT }}