Publish to NPM #23
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
name: Publish to NPM | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
type: choice | |
description: "choose package" | |
default: "agora-rtc-react" | |
required: true | |
options: | |
- agora-rtc-react | |
- agora-rtc-react-ui | |
increment: | |
description: 'Increment "major", "minor", "patch", or "pre*" version; or specify version [default: "patch"]' | |
required: true | |
default: "patch" | |
type: string | |
dry-run: | |
description: "Do not touch or write anything, but show the commands" | |
default: true | |
type: boolean | |
jobs: | |
release-it: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Setup Dependencies 💚 | |
run: | | |
pnpm install | |
- name: Setup NPM auth token | |
run: | | |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }} | |
- name: Dry Run Release | |
if: ${{ inputs.dry-run }} | |
run: | | |
pnpm -F ${{ inputs.package }} release ${{ inputs.increment }} -d --ci | |
- name: Config Git | |
if: ${{ !inputs.dry-run }} | |
run: | | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --global user.name "${{ github.actor }}" | |
- name: Update CHANGELOG.md | |
if: ${{ !inputs.dry-run }} | |
run: | | |
pnpm release ${{ inputs.increment }} --ci --no-git.tag --no-github.release --npm.allowSameVersion | |
- name: Update VERSION | |
if: ${{ !inputs.dry-run }} | |
run: | | |
pnpm -F ${{ inputs.package }} exec esbuild-dev $PWD/scripts/release/update-version.ts target:${{ inputs.package }} @${{ inputs.increment }} | |
- name: NPM Publish | |
if: ${{ !inputs.dry-run }} | |
run: | | |
pnpm -F ${{ inputs.package }} release ${{ inputs.increment }} --ci --github.release=true |