name: Publish npm (codetether npx wrapper)
on:
release:
types: [published]
workflow_dispatch: {}
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
if: ${{ secrets.NPM_TOKEN != '' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Set npm package version from git tag
working-directory: npm/codetether
run: |
set -euo pipefail
tag="${{ github.event.release.tag_name || github.ref_name }}"
ver="${tag#v}"
npm version "$ver" --no-git-tag-version
- name: Install dependencies
working-directory: npm/codetether
run: npm install --omit=dev
- name: Publish
working-directory: npm/codetether
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public