By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: Releasing Utilities Package to GitHub Packages: A Guide | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > Releasing Utilities Package to GitHub Packages: A Guide | HackerNoon
Computing

Releasing Utilities Package to GitHub Packages: A Guide | HackerNoon

News Room
Last updated: 2025/05/19 at 7:09 PM
News Room Published 19 May 2025
Share
SHARE

Releasing a closed-source, reusable JavaScript/TypeScript package for internal use across frontend and backend is a common challenge, especially when you want to automate it, keep things modular, and avoid unnecessary leakage of code. Here’s how I do it, step by step, using only what’s needed for a stable, repeatable workflow.

Why GitHub Packages (and Not npmjs.org)?

Most teams reach for npmjs.org by default, but if your utilities are strictly internal – or have some private contract processing logic you’re not ready to open-source – GitHub’s own registry is more than enough:

  • Integrated with your repository: No extra accounts or keys to manage.
  • Scoped access: Control exactly who gets your code.
  • Familiar workflows: Your team’s already on GitHub; why hop away?

I’ve used this for smart contract SDKs referenced by both the frontend app and the NestJS API.

Directory Structure

I keep only my distributable code in /package, separate from internal scripts/docs, to avoid accidentally leaking dev files.

|-- .github/
|-- src/
|-- package/           # <--- Only your published files live here
    |-- package.json
    |-- dist/
    |-- index.js
|-- ...

Pro tip: npm publish runs only in /package, not at the repo root.

Manual Releases Triggered From GitHub Releases

Every package update is explicitly tagged as a release in GitHub’s UI, which helps prevent accidental releases of incomplete work.

github release package pagegithub release package page

Action Workflow File

Below is the full workflow that gets the job done.

name: Publish package on GitHub Packages

on:
  release:
    types: [created]

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write

    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-node@v3
        with:
          node-version: 18
          registry-url: "https://npm.pkg.github.com"
          scope: "@your-user-name"
          always-auth: true

      - name: Install dependencies
        run: npm ci

      - name: Build package
        run: npm run package

      - name: Install package dependencies
        working-directory: ./package
        run: npm ci

      - name: Publish package
        working-directory: ./package
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Place it in github/workflows/publish.yml

Key Parts

  • Scopes, Not Monorepos: No workspaces, no publishing the entire repo.
  • No Source Leakage: Only files in /package are seen by consumers—no accidental pushes of TS, docs, or git history.
  • Manual Trigger: The process kicks off only when you create a GitHub Release, not on every push or PR.

Real-World Example

Let’s say you update a Smart Contracts ABI in /src, then run your internal build (maybe via a simple "package" script) to output to /package/dist.

Only that transpiled, dependency-free version ships.

Your API team can safely pull it via:

npm install @user/package-name --registry=https://npm.pkg.github.com

From both backend and frontend, with no npmjs exposure.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article SteelSeries Arctis GameBuds Review
Next Article Researchers made a stretchy battery that can change into any shape
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

PM threatens ‘further action’ if Israel doesn’t abandon plan to take over Gaza
News
China’s smartphone shipments reach 289 million units, up 6.5% y-o-y in 2023 · TechNode
Computing
How AI factories are reshaping enterprise infrastructure – News
News
Today's NYT Connections Hints, Answers for May 24, #713
News

You Might also Like

Computing

China’s smartphone shipments reach 289 million units, up 6.5% y-o-y in 2023 · TechNode

1 Min Read

TuSimple shifts to Asia Pacific amid Nasdaq delisting · TechNode

1 Min Read
Computing

Xianyu to open first offline secondhand marketplace as Alibaba emphasizes high hopes for the platform · TechNode

3 Min Read
Computing

2023 TechNode Content Team Annual Insights: Breakthrough of Tech Optimism · TechNode

7 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?