You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
name: Push to Main CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
build-and-package:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: '**/pnpm-lock.yaml'
|
|
|
|
- name: Cache pnpm dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.pnpm-store
|
|
packages/*/node_modules
|
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: Build All Packages
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# Add package folders you want to exclude here (space-separated)
|
|
EXCLUDED_DIRS=("packages/protobufs")
|
|
|
|
for pkg_dir in packages/*/; do
|
|
pkg_dir=${pkg_dir%/} # Remove trailing slash
|
|
echo "🔍 Inspecting $pkg_dir..."
|
|
|
|
# Check if directory is excluded
|
|
if [[ " ${EXCLUDED_DIRS[*]} " == *" $pkg_dir "* ]]; then
|
|
echo "🚫 Skipping $pkg_dir (excluded)"
|
|
continue
|
|
fi
|
|
|
|
# Build only if it has a package.json
|
|
if [[ -f "$pkg_dir/package.json" ]]; then
|
|
echo "🔧 Building with pnpm: $pkg_dir"
|
|
(cd "$pkg_dir" && pnpm install --frozen-lockfile && pnpm run build:npm)
|
|
else
|
|
echo "⚠️ Skipping $pkg_dir (no package.json)"
|
|
fi
|
|
done
|
|
|
|
|