NPM Package #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 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}} |