NPM Publish #4
This file contains hidden or 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: NPM Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish_type: | |
| description: 'Type of publish to perform' | |
| required: true | |
| default: 'stable' | |
| type: choice | |
| options: | |
| - stable | |
| - canary | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch full history for Lerna to work properly | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 16 | |
| check-latest: true | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test | |
| # - name: Run linting | |
| # run: npm run lint | |
| - name: Publish packages | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| if [ "${{ github.event.inputs.publish_type }}" = "canary" ]; then | |
| npm run publish:canary | |
| else | |
| npm run publish:stable | |
| fi |