Make line endings deterministic across macOS, Windows, and Linux while preserving the native checkout format required by Windows launchers. Pin the tested application runtime and Node type baseline, add a shared startup preflight, and keep independently published packages on their existing compatibility ranges. Align local scripts, pull request validation, complete package builds, dependency metadata, and contributor documentation around the same Node and pnpm contract. The root test command now covers every tested workspace package while a focused Core command remains available for local iteration.
104 lines
3.1 KiB
YAML
104 lines
3.1 KiB
YAML
name: Publish UI to npm
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'packages/ui/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'pnpm-workspace.yaml'
|
|
- 'tsconfig.base.json'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: ui-npm-publish-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
publish:
|
|
name: Build and publish UI
|
|
runs-on: ubuntu-latest
|
|
environment: SnowLuma
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
with:
|
|
version: 10.28.0
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: '.node-version'
|
|
cache: 'pnpm'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Type check UI
|
|
run: pnpm --filter @snowluma/ui typecheck
|
|
|
|
- name: Build UI
|
|
run: pnpm --filter @snowluma/ui build
|
|
|
|
- name: Check npm package version
|
|
id: npm
|
|
working-directory: packages/ui
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
package_name="$(node -e "const fs = require('node:fs'); console.log(JSON.parse(fs.readFileSync('package.json', 'utf8')).name)")"
|
|
package_version="$(node -e "const fs = require('node:fs'); console.log(JSON.parse(fs.readFileSync('package.json', 'utf8')).version)")"
|
|
|
|
{
|
|
echo "package_name=${package_name}"
|
|
echo "package_version=${package_version}"
|
|
} >> "${GITHUB_OUTPUT}"
|
|
|
|
if npm view "${package_name}@${package_version}" version >/dev/null 2>&1; then
|
|
echo "already_published=true" >> "${GITHUB_OUTPUT}"
|
|
echo "::notice::${package_name}@${package_version} already exists on npm; skipping publish."
|
|
else
|
|
echo "already_published=false" >> "${GITHUB_OUTPUT}"
|
|
fi
|
|
|
|
- name: Validate npm token
|
|
if: steps.npm.outputs.already_published != 'true'
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: |
|
|
if [ -z "${NODE_AUTH_TOKEN}" ]; then
|
|
echo 'Missing NPM_TOKEN in the SnowLuma environment secrets.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Publish UI to npm
|
|
if: steps.npm.outputs.already_published != 'true'
|
|
working-directory: packages/ui
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: npm publish --access public --provenance
|
|
|
|
- name: Summary
|
|
shell: bash
|
|
run: |
|
|
{
|
|
echo "## UI npm publish"
|
|
echo
|
|
echo "| Key | Value |"
|
|
echo "| --- | --- |"
|
|
echo "| Package | \`${{ steps.npm.outputs.package_name }}\` |"
|
|
echo "| Version | \`${{ steps.npm.outputs.package_version }}\` |"
|
|
echo "| Already published | \`${{ steps.npm.outputs.already_published }}\` |"
|
|
echo "| Environment | \`SnowLuma\` |"
|
|
} >> "${GITHUB_STEP_SUMMARY}"
|