-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Publish to npmjs | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package: | ||
type: choice | ||
description: Which package to publish? | ||
options: | ||
- vad-web | ||
- vad-react | ||
- vad-node | ||
dry-run: | ||
type: boolean | ||
description: Dry run? | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Set Working Directory | ||
run: | | ||
if [ "${{ github.event.inputs.package }}" == "vad-web" ]; then | ||
echo "WORKING_DIRECTORY=./packages/web" >> $GITHUB_ENV | ||
elif [ "${{ github.event.inputs.package }}" == "vad-react" ]; then | ||
echo "WORKING_DIRECTORY=./packages/react" >> $GITHUB_ENV | ||
elif [ "${{ github.event.inputs.package }}" == "vad-node" ]; then | ||
echo "WORKING_DIRECTORY=./packages/node" >> $GITHUB_ENV | ||
fi | ||
- run: npm ci | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
|
||
- name: Publish Package | ||
run: | | ||
if [ "${{ github.event.inputs.dry-run }}" == "true" ]; then | ||
npm publish --access=public --dry-run | ||
else | ||
npm publish --access=public | ||
fi | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
working-directory: ${{ env.WORKING_DIRECTORY }} |