Publish Packages to NPM #2
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 Packages to NPM | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'version' | |
required: true | |
default: 'patch' | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
# Build job | |
build: | |
environment: publish_version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Not needed if lastUpdated is not enabled | |
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm | |
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm # or pnpm / yarn | |
- name: Install dependencies | |
run: npm ci # or pnpm install / yarn install / bun install | |
- name: Lint | |
run: | | |
npm run lint | |
- name: Build purista core | |
run: | | |
npm run build -w packages/core | |
- name: Build purista packages | |
run: | | |
npm run build | |
#- name: Test | |
# run: | | |
# npm run test:unit | |
- name: Bump version | |
run: | | |
npm version ${{ inputs.version }} --no-git-tag-version --workspaces | |
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}' | |
git config --global user.email '[email protected]' | |
scripts/commitVersion.sh | |
echo $(node -p -e "require('./package.json').version") | |
id: bump_version | |
- name: Add Tag | |
run: | | |
git tag ${{ steps.bump_version }} | |
- name: Dry run publish | |
run: | | |
npm publish --access public --dry-run | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
#- name: Commit version | |
# run: | | |
# git push | |
# - name: Publish | |
# run: npm publish --access public | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |