Skip to content

npm

npm #37

Workflow file for this run

name: "npm"
on:
workflow_run:
workflows:
- "Release"
types:
- completed
permissions:
contents: read
jobs:
pack:
if: ${{ github.event.workflow_run.event == 'release' && github.event.workflow_run.conclusion == 'success' }}
name: "Pack"
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
# Setup Bun
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.1
# Install dependencies
- name: Install dependencies
run: bun install
# Set Version
- name: Set TAG variable
run: |
echo "Full ref: ${{ github.event.workflow_run.head_branch }}"
echo "TAG=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
- name: Set VERSION variable
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Set Version
run: npm version $VERSION --no-git-tag-version
# Set Authentication
- name: Create .npmrc
run: |
{
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
} | tee -a .npmrc
# Publish
- name: Publish
run: npm publish --access public