Skip to content

🏷️ Publish NPM Beta #20

🏷️ Publish NPM Beta

🏷️ Publish NPM Beta #20

name: 🏷️ Publish NPM Beta
on: workflow_dispatch
permissions:
contents: write
id-token: write
jobs:
deploy-npm-beta:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 3
token: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ github.event.pull_request.merged != true && contains('["ghiscoding"]', github.actor) != true }}
name: Ensure current actor is allowed to run the workflow
run: |
echo "Error: Your GitHub username (${{ github.actor }}) is not on the allowed list of admins for this workflow"
exit 1
- name: Set NodeJS
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org/'
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run pnpm install dependencies
run: pnpm install
- name: Lerna Version 🏷️
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${{ github.actor }})"
git config user.email "users.noreply.github.com"
npm whoami
lerna version prerelease --conventional-commits --conventional-prerelease --preid beta --yes
- name: OTP
uses: step-security/wait-for-secrets@v1
id: wait-for-secrets
with:
secrets: |
OTP:
name: 'OTP to publish package'
description: 'OTP from authenticator app'
- name: Lerna Publish 📦
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
git config user.name "${{ github.actor }})"
git config user.email "users.noreply.github.com"
npm whoami
lerna publish prerelease from-package --dist-tag next --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}