Skip to content

Commit

Permalink
add publish workflow (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricky0123 authored Nov 10, 2023
1 parent c01b42e commit f9ae90e
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
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 }}

0 comments on commit f9ae90e

Please sign in to comment.