Skip to content

NPM Package

NPM Package #24

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
with:
path: getargv.js
- run: sed -e 's/@camjn/@getargv/' -i '' package.json
working-directory: getargv.js
- uses: actions/setup-node@v4
with:
node-version: latest
registry-url: https://npm.pkg.github.com/
- run: npm ci
working-directory: getargv.js
- run: npm publish
working-directory: getargv.js
env:
NODE_AUTH_TOKEN: ${{ github.token }}
- run: npm config list
working-directory: getargv.js
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
with:
path: getargv.js
- uses: actions/setup-node@v4
with:
node-version: latest
registry-url: https://registry.npmjs.org/
- run: npm ci
working-directory: getargv.js
- run: npm publish --provenance --access public
working-directory: getargv.js
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}