Skip to content

Manually publish to NPM - Apply changeset in the workflow. #20

Manually publish to NPM - Apply changeset in the workflow.

Manually publish to NPM - Apply changeset in the workflow. #20

Workflow file for this run

name: Manually publish to NPM - Apply changeset in the workflow.
# publish only when package json has changed - assuming version upgrade
on:
workflow_dispatch:
jobs:
publish:
if: github.event.repository.owner.login == 'react18-tools'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- run: npm i -g [email protected] && pnpm i
name: Install dependencies
# fail and not publish if any of the unit tests are failing
- name: Test
run: pnpm test
- name: clean up working directory
run: git status && git clean -f -d && git status
- name: Setup Git
run: | # todo - configure to run for branch for which it is triggered
git config --global user.name "mayank1513"
git config --global user.email "[email protected]"
# - name: Copy Readme file
# run: cp ../README.md . # todo: uncomment this line while rebranding
- name: Apply changesets and publish
run: node ./scripts/publish.js
env:
BRANCH: ${{ github.ref_name }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}