split the package check and publish into separate workflows

This commit is contained in:
Gregor Vostrak
2026-12-02 13:12:33 +01:00
parent 436c3b5cca
commit 3f60286410
2 changed files with 42 additions and 34 deletions

View File

@@ -0,0 +1,37 @@
name: NPM Packages Check
# Type-checks and builds the shared packages on every PR that touches them.
on:
pull_request:
paths:
- 'resources/js/packages/**'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/npm-packages-check.yml'
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
# Dependency order: ui and composables build against api
PACKAGES: api ui composables
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24.x'
- run: npm ci
- name: Type-check and build packages
run: |
for package in $PACKAGES; do
dir="resources/js/packages/$package"
[ -d "$dir" ] || continue
echo "::group::$package"
npm run type-check --if-present --prefix "$dir"
npm run build --prefix "$dir"
echo "::endgroup::"
done

View File

@@ -1,14 +1,8 @@
name: NPM Packages
# Builds and type-checks the shared packages on every PR. On main, publishes
# each package whose version isn't on npm yet.
# Publishes each shared package whose version isn't on npm yet. npm's trusted
# publisher config points at this file, so keep unrelated changes out of it.
on:
pull_request:
paths:
- 'resources/js/packages/**'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/npm-packages.yml'
push:
branches: [main]
paths:
@@ -19,34 +13,8 @@ on:
permissions:
contents: read
env:
# Dependency order: ui and composables build against api
PACKAGES: api ui composables
jobs:
check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24.x'
- run: npm ci
- name: Type-check and build packages
run: |
for package in $PACKAGES; do
dir="resources/js/packages/$package"
[ -d "$dir" ] || continue
echo "::group::$package"
npm run type-check --if-present --prefix "$dir"
npm run build --prefix "$dir"
echo "::endgroup::"
done
publish:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 15
# Restricted to main in the repo settings, which a branch can't override
@@ -58,6 +26,9 @@ jobs:
permissions:
contents: read
id-token: write # npm trusted publishing and provenance
env:
# Dependency order: ui and composables build against api
PACKAGES: api ui composables
steps:
- uses: actions/checkout@v7
with: