Skip to content

docs: update package size information in README #2

docs: update package size information in README

docs: update package size information in README #2

Workflow file for this run

name: Automated Release
on:
push:
branches:
- main
jobs:
release:
if: contains(github.event.head_commit.message, '[patch]') || contains(github.event.head_commit.message, '[minor]') || contains(github.event.head_commit.message, '[major]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Determine version bump type
id: bump-type
run: |
if [[ "${{ github.event.head_commit.message }}" == *"[major]"* ]]; then
echo "type=major" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.head_commit.message }}" == *"[minor]"* ]]; then
echo "type=minor" >> $GITHUB_OUTPUT
else
echo "type=patch" >> $GITHUB_OUTPUT
fi
- name: Get current version
id: current-version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- name: Calculate new version
id: new-version
run: |
CURRENT="${{ steps.current-version.outputs.version }}"
TYPE="${{ steps.bump-type.outputs.type }}"
# Parse version numbers
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
case $TYPE in
major)
NEW_VERSION="$((MAJOR + 1)).0.0"
;;
minor)
NEW_VERSION="$MAJOR.$((MINOR + 1)).0"
;;
patch)
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
;;
esac
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Update package.json version
run: |
npm version ${{ steps.new-version.outputs.version }} --no-git-tag-version
- name: Build package
run: npm run package
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create git tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag "v${{ steps.new-version.outputs.version }}"
git push origin "v${{ steps.new-version.outputs.version }}"
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.new-version.outputs.version }}
release_name: Release v${{ steps.new-version.outputs.version }}
body: |
Automated release v${{ steps.new-version.outputs.version }}
Changes in this release:
- ${{ github.event.head_commit.message }}