Skip to content

updated workflow

updated workflow #2

Workflow file for this run

name: Publish Package on Release
on:
push:
branches:
- main
jobs:
publish:
if: startsWith(github.ref, 'refs/heads/release/')
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Set up Node.js and pnpm
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 23.x # Specify the Node.js version you use
registry-url: https://npm.pkg.github.com
# Install dependencies with pnpm
- uses: pnpm/action-setup@v4
with:
run_install: true
# Publish to GitHub Package Registry (prepublish script will run automatically)
- name: Publish to GitHub Package Registry
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm publish
# Extract version from branch name and create a tag
- name: Create version tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Extract version (e.g., x.x.x) from branch name 'release/x.x.x'
VERSION=$(echo "${{ github.ref_name }}" | sed 's/release\///')
echo "Creating tag for version: $VERSION"
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"