Publish Package to npmjs #78
Workflow file for this run
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: Publish Package to npmjs | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Set git username | |
| run: git config --global user.name ${{ github.actor }} | |
| - name: Set git user email | |
| run: git config --global user.email "github-action-${{ github.actor }}.users.noreply.github.com" | |
| - name: Install dependencies and build | |
| run: npm ci | |
| - name: Publish package to npm | |
| run: | | |
| if | |
| [[ ${{ github.event.release.tag_name }} == *'alpha'* ]]; | |
| then | |
| npm version ${{ github.event.release.tag_name }}; | |
| npm publish --tag alpha; | |
| elif | |
| [[ ${{ github.event.release.tag_name }} == *'beta'* ]]; | |
| then | |
| npm version ${{ github.event.release.tag_name }}; | |
| npm publish --tag beta; | |
| else | |
| npm publish | |
| fi |