chore: update dependencies (#107) #15
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: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Type of release (release or prerelease)' | |
| default: 'release' | |
| type: string | |
| push: | |
| branches: [ 'master' ] | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/ci.yml | |
| release: | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'push' && | |
| (startsWith(github.event.head_commit.message, 'release:') || | |
| startsWith(github.event.head_commit.message, 'prerelease:'))) | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Setup .npmrc file to publish to npm | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| # Install dependencies without modifying package-lock.json file | |
| - name: Install deps | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Publish | |
| if: ${{ (inputs.release_type == 'release') || (github.event.head_commit.message && startsWith(github.event.head_commit.message, 'release:')) }} | |
| run: npm publish ./dist | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| - name: Publish Next | |
| if: ${{ (inputs.release_type == 'prerelease') || (github.event.head_commit.message && startsWith(github.event.head_commit.message, 'prerelease:')) }} | |
| run: npm publish ./dist --tag next | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| - name: Tag release commit | |
| run: | | |
| TAG_NAME="v$(node -p "require('./package.json').version")" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Tag $TAG_NAME already exists. Skipping." | |
| else | |
| git tag "$TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| fi |