Fix Vulnerabilty Warnings! #154
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: Branch Release | |
on: | |
push: | |
branches: | |
- '**' | |
- '!main' | |
jobs: | |
branch-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history to get the latest tag | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Cache pnpm modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.pnpm-store | |
node_modules | |
src/playground/node_modules | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm run build | |
- name: Set Version from Branch | |
run: | | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
BRANCH_NAME=${BRANCH_NAME//\//-} # Replace slashes with dashes | |
SHORT_SHA=$(git rev-parse --short HEAD) | |
# Get the latest version tag and increment patch | |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
LATEST_VERSION=${LATEST_TAG#v} # Remove 'v' prefix | |
# Split version into major.minor.patch | |
IFS='.' read -r major minor patch <<< "$LATEST_VERSION" | |
# Increment patch version | |
patch=$((patch + 1)) | |
BASE_VERSION="${major}.${minor}.${patch}" | |
VERSION="${BASE_VERSION}-${BRANCH_NAME}-${SHORT_SHA}" | |
pnpm version $VERSION --no-git-tag-version | |
- name: Configure NPM Authentication | |
run: | | |
echo "@bitte-ai:registry=https://registry.npmjs.org/" > ~/.npmrc | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | |
- name: Publish with npm | |
run: npm publish --access public --tag beta | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |