Skip to content

Publish to npmjs

Publish to npmjs #12

Workflow file for this run

name: Publish to npmjs
on:
# Who has permission to workflow_dispatch
# https://github.com/orgs/community/discussions/26622
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
type: string
distTag:
description: 'Used as lerna publish --dist-tag'
default: 'latest'
required: true
type: string
jobs:
publish:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# checkout is pinned to dev branch here
ref: dev
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './.node-version'
registry-url: 'https://registry.npmjs.org'
- name: Cache Deps
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles( 'yarn.lock' ) }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Fetch Deps
run: yarn install --frozen-lockfile
- name: Set git username and email
run: |
git config --local user.email "action@github.com"
git config --local user.name "actions-user"
- name: Set package version
run: |
yarn lerna version ${{ github.event.inputs.version }} --exact --no-push --yes
yarn lerna publish from-git -y --dist-tag ${{ github.event.inputs.distTag }}
env:
NPM_CONFIG_PROVENANCE: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Git push version up commits
run: |
git push origin --tags ${{ github.ref_name }}
- name: Upload Builds
uses: actions/upload-artifact@v3
with:
name: build
path: |
packages/*/lib/
packages/*/types/
packages/*/ts*/