Skip to content

Publish Package

Publish Package #1

Workflow file for this run

name: Publish to GitHub Packages
on:
release:
types: [created]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'
scope: '@perrygamerpt'
- name: Verify package structure
run: |
echo "Checking required files..."
ls -la index.cjs index.mjs index.d.ts README.md LICENSE
node -e "const pkg = require('./package.json'); console.log('Package:', pkg.name, pkg.version)"
- name: Test CommonJS import
run: node -e "const { TcpShieldClient } = require('./index.cjs'); console.log('CJS OK')"
- name: Test ESM import
run: node --input-type=module -e "import('./index.mjs').then(() => console.log('ESM OK'))"
- name: Publish to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}