Skip to content

Publish to npm registry #48

Publish to npm registry

Publish to npm registry #48

Workflow file for this run

name: Publish to npm registry
on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (one of): patch, minor, major'
required: true
type: choice
default: 'patch'
options:
- patch
- minor
- major
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: https://registry.npmjs.org/
scope: '@devexperts'
- name: Git Configuration
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Bump version
run: |
echo "NEW_TAG=$(npm --no-git-tag-version version $RELEASE_TYPE)" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
- name: Commit changes
run: |
git commit -a -m "ci: release ${{ env.NEW_TAG }}"
- name: Create new tag
run: |
git tag ${{ env.NEW_TAG }}
# - name: Publish
# run: npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPMJS_DEVEXPERTS_BOT_PUBLISH_TOKEN}}
- name: Push changes to repository
run: |
git push https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git ${{ github.ref }}
git push https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git --tags