Publish to npm registry #47
This file contains 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 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.email "[email protected]" | |
git config user.name "dxpm" | |
- 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 |