Skip to content

chore: add npm publish workflow and .npmignore #1

chore: add npm publish workflow and .npmignore

chore: add npm publish workflow and .npmignore #1

Workflow file for this run

name: Release (tag)
on:
pull_request:
types: [closed]
branches:
- main
jobs:
tag-release:
if: "${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Release: ') }}"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- run: |
VERSION=$(node -p "require('./package.json').version")
TAG="v$VERSION"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
if git ls-remote --tags origin | grep -q "refs/tags/$TAG$"; then
echo "::error::Tag $TAG already exists. Bump the version in package.json first."
exit 1
fi
git tag "$TAG"
git push origin "$TAG"
publish:
needs: tag-release
runs-on: ubuntu-latest
environment:
name: release
name: Publish
permissions:
contents: write
id-token: write
steps:
- uses: holepunchto/actions/node-base@v1
with:
allow-git: all
- uses: holepunchto/actions/publish@v1