Skip to content

React version updated #10

React version updated

React version updated #10

Workflow file for this run

name: Publish to npm
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to publish (patch, minor, major, or specific version)"
required: true
default: "patch"
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org/"
- name: Configure npm to ignore scripts
run: |
echo "ignore-scripts=true" > .npmrc
cat .npmrc
- name: Check for prepublishOnly script
run: |
echo "Package.json content:"
cat package.json
echo "Checking for prepublishOnly:"
grep -i prepublishOnly package.json || echo "No prepublishOnly script found in package.json"
- name: Ensure no prepublishOnly script
run: |
# Install jq for JSON manipulation
sudo apt-get update && sudo apt-get install -y jq
# Update package name to lowercase
jq '.name = "@techfusionmasters/tanstack-table-adapter"' package.json > package.json.tmp
mv package.json.tmp package.json
# Verify changes
echo "Updated package.json name to lowercase:"
cat package.json | grep name
# Create a new package.json without prepublishOnly script
jq 'del(.scripts.prepublishOnly)' package.json > package.json.tmp
mv package.json.tmp package.json
# Remove test script as well
jq 'del(.scripts.test)' package.json > package.json.tmp
mv package.json.tmp package.json
# Verify changes
echo "Updated package.json:"
cat package.json
- name: Install dependencies
run: npm ci
- name: Clean build directory
run: npm run clean
- name: Build package
run: |
npm run build
npm run build:types
- name: Update version (if using workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
if [[ "${{ github.event.inputs.version }}" =~ ^(patch|minor|major)$ ]]; then
npm version ${{ github.event.inputs.version }} --no-git-tag-version
else
npm version ${{ github.event.inputs.version }} --allow-same-version --no-git-tag-version
fi
echo "New version: $(npm pkg get version)"
- name: Publish to npm
run: npm publish --access public --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}