blob-fns
Version:
Blob fns is a lightweight, versatile npm package designed to simplify working with Blob objects in JavaScript. Whether you're dealing with text, JSON, images, or binary data, Blob Utilities provides an easy-to-use API for creating, converting, and manipul
71 lines (56 loc) • 1.78 kB
YAML
name: Publish npm Package
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build
- name: Commit uncommitted changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore: commit changes before version bump" || echo "No changes to commit"
- name: Bump version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm version patch -m "chore(release): %s [skip ci]"
- name: Configure NPM authentication
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Show .npmrc
run: cat ~/.npmrc
- name: Verify NPM_TOKEN
run: |
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
echo "NPM_TOKEN is not set"
exit 1
else
echo "NPM_TOKEN is set"
fi
- name: Debug npm whoami
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
- name: Push changes and tags
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push origin HEAD:main --tags