Publish the package #12
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 the package | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Package version | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
registry-url: https://registry.npmjs.org | |
scope: '@chaocore' | |
- name: Corepack enable | |
run: corepack enable | |
- name: Installing dependencies | |
run: yarn | |
- name: All checks | |
run: yarn all:checks | |
- name: Build | |
run: yarn build | |
- name: Updating version | |
run: | | |
git config user.name $GITHUB_ACTOR | |
git config user.email $GITHUB_ACTOR@users.noreply.github.com | |
npm version ${{ github.event.inputs.version }} | |
- name: Deleting the postinstall script in package.json before publishing | |
run: npm pkg delete scripts.postinstall | |
- name: Publishing the package | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Pushing version and tag to repository | |
run: | | |
git push origin main | |
git push origin v${{ github.event.inputs.version }} |