Skip to content

NPM Package

NPM Package #20

Workflow file for this run

# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: NPM Package
on:
push:
tags: [ '*' ]
jobs:
publish-gpr:
runs-on: macos-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
- run: sed -e 's/@camjn/@getargv/' -i '' package.json
- uses: actions/setup-node@v4
with:
node-version: latest
scope: '@getargv'
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: |
echo registry=https://npm.pkg.github.com/ > .npmrc
echo always-auth=true >> .npmrc
echo //npm.pkg.github.com/:_authToken=${{ github.token }} >> .npmrc
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ github.token }}
- run: npm config list
if: ${{ failure() }}
publish-npm:
runs-on: macos-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}