Require patched Node.js releases and refresh affected application and build dependencies. Align installation requirements, startup checks, and release workflows with the security baseline.
103 lines
3.2 KiB
YAML
103 lines
3.2 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: 11.25.0
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
# Trusted Publishing requires Node >=22.14 and npm >=11.5.1.
|
|
# Use the same patched runtime as application builds.
|
|
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: Show Trusted Publishing toolchain
|
|
if: steps.npm.outputs.already_published != 'true'
|
|
run: |
|
|
node --version
|
|
npm --version
|
|
|
|
- name: Publish UI to npm
|
|
if: steps.npm.outputs.already_published != 'true'
|
|
working-directory: packages/ui
|
|
# Authentication is supplied by npm Trusted Publishing through the
|
|
# GitHub OIDC token (permissions.id-token: write above).
|
|
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\` |"
|
|
echo "| Authentication | npm Trusted Publishing (GitHub OIDC) |"
|
|
} >> "${GITHUB_STEP_SUMMARY}"
|