feat: generateUniqueId with customizable length #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🏷️ Publish and Deploy Documentation | |
on: | |
push: | |
tags: | |
- 'v*' # Only trigger when a version tag is pushed, like v1.0.0 | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read # Publish no need to write | |
packages: write # Required for NPM publish | |
steps: | |
# Step 1: Checkout code | |
- name: 📂 Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js for npm | |
- name: 📦 Set up Node.js for npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
registry-url: 'https://registry.npmjs.org' # Default to npm registry | |
# Step 3.1: Install dependencies | |
- name: 🛠️ Install dependencies | |
run: npm install --legacy-peer-deps | |
# Step 3.2: Set up Node.js and pnpm | |
- name: 📦 Set up Node.js and pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
run_install: true | |
# Step 4: Lint, format, and test | |
- name: 🎨 Lint, format, and test | |
run: | | |
pnpm run lint:fix | |
pnpm run format | |
pnpm run test:fast | |
npm run build | |
# Step 5: Publish to NPM | |
- name: 🚀 Publish to npm | |
run: npm publish --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Step 6: Set up Node.js for GitHub Packages | |
- name: 🏡 Set up Node.js for GitHub Packages | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://npm.pkg.github.com' | |
# Step 7: Publish to GitHub Packages | |
- name: 🏡 Publish to GitHub Packages | |
run: npm publish --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-jsr: | |
runs-on: ubuntu-latest | |
needs: publish # Only run after the publish job succeeds | |
permissions: | |
contents: read # Publish no need to write | |
id-token: write # Required for JSR publish | |
steps: | |
# Step 1: Checkout code | |
- name: 📂 Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Publish to JSR | |
- name: 🌟 Publish to JSR | |
run: npx jsr publish --allow-dirty | |
deploy-docs: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
# Step 1: Checkout code | |
- name: 📂 Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js and pnpm | |
- name: 📦 Set up Node.js and pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
run_install: true | |
# Step 3: Build and deploy documentation | |
- name: 📘 Build Documentation | |
run: | | |
pnpm run docs | |
pnpm run docs:build | |
# Step 4: Deploy to docs branch | |
- name: 🚀 Deploy to docs branch | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: docs/.vitepress/dist | |
branch: docs | |
token: ${{ secrets.GITHUB_TOKEN }} |