From f9ae90e6d984ef56d8b10e9c1d41a7d784346598 Mon Sep 17 00:00:00 2001 From: Ricky Samore Date: Fri, 10 Nov 2023 12:49:40 -0600 Subject: [PATCH] add publish workflow (#52) --- .github/workflows/publish.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8f854a8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 }}