Skip to content

Publish to NPM

Publish to NPM #47

Workflow file for this run

name: Publish to NPM
# on:
# release:
# types: [published]
on: workflow_dispatch
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.com/
scope: '@relewise'
- name: Calculate environment variables
run: |
echo "TAG_NAME=${{ github.event.release.tag_name }}"
echo "PACKAGE_PATH=$(github.ref_name | cut -d '@' -f 1)" >> $GITHUB_ENV
echo "VERSION=$(github.ref_name | cut -d '@' -f 2)" >> $GITHUB_ENV
- uses: brettdorrans/write-version-to-file@master
if: ${{ env.PACKAGE_PATH == 'client' }}
name: Update version
env:
working-directory: ./packages/${ PACKAGE_PATH }
with:
filename: './src/version.ts'
placeholder: '${VERSION}'
- run: npm ci
env:
working-directory: ./packages/${ PACKAGE_PATH }
- run: npm run publish
env:
working-directory: ./packages/${ PACKAGE_PATH }
- run: npm publish --access public
env:
working-directory: ./packages/${ PACKAGE_PATH }
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}