Skip to content

Bump the development-dependencies group with 3 updates #309

Bump the development-dependencies group with 3 updates

Bump the development-dependencies group with 3 updates #309

Workflow file for this run

name: npm Package
on:
pull_request:
paths:
- ".github/workflows/npm-package.yml"
- "apps/server/**"
- "apps/web/**"
- "packages/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "vite.config.ts"
workflow_dispatch:
inputs:
version:
description: "Optional package version to publish. Blank uses apps/server/package.json."
required: false
type: string
dist_tag:
description: "npm dist-tag for publishing."
required: true
default: latest
type: choice
options:
- latest
- nightly
publish:
description: "Publish to npm. Leave false for a dry run."
required: true
default: false
type: boolean
permissions:
contents: read
jobs:
pack:
name: Build and dry-run package
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Vite+
uses: voidzero-dev/setup-vp@313600b80b104eadebb9111787d37a2e83e014ca # v1.17.0
with:
node-version-file: package.json
cache: true
version: "0.2.4"
run-install: false
- name: Install dependencies
run: vp install --frozen-lockfile
- name: Align package versions
if: ${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }}
run: node scripts/update-release-package-versions.ts "${{ inputs.version }}"
- name: Build server package
env:
THREADLINES_POSTHOG_KEY: ${{ secrets.THREADLINES_POSTHOG_KEY }}
THREADLINES_POSTHOG_HOST: ${{ vars.THREADLINES_POSTHOG_HOST }}
THREADLINES_TELEMETRY_ENABLED: ${{ vars.THREADLINES_TELEMETRY_ENABLED }}
run: vp exec vp run --filter @threadlines/server build
- name: Prepare npm package
run: node scripts/prepare-server-npm-package.ts
- name: Apply brand assets
run: node scripts/apply-web-brand-assets.ts production release/npm-server/dist/client
- name: Dry-run npm package
working-directory: release/npm-server
shell: bash
run: |
npm pack --dry-run 2>&1 | tee /tmp/npm-pack-dry-run.log
grep -q "dist/client/index.html" /tmp/npm-pack-dry-run.log
# Install the packed tarball the way a real `npx @threadlines/server` user
# would (fresh tree, registry-resolved transitive deps) and require it to
# boot. Catches what the tarball grep cannot: dependency skew like the
# 0.3.1 release, where a peer range resolved to a second copy of effect
# and the server exited 1 before printing anything.
- name: Smoke test packed artifact
shell: bash
run: |
set -euo pipefail
pack_dir="$GITHUB_WORKSPACE/release/npm-server"
tarball="$(cd "$pack_dir" && npm pack --silent)"
smoke_dir="$(mktemp -d)"
cd "$smoke_dir"
npm install --no-audit --no-fund --loglevel=error "$pack_dir/$tarball"
effect_copies="$(find node_modules -path '*node_modules/effect/package.json' | wc -l)"
if [ "$effect_copies" -ne 1 ]; then
echo "Expected exactly one installed copy of effect, found $effect_copies:"
find node_modules -path '*node_modules/effect/package.json'
exit 1
fi
node node_modules/@threadlines/server/dist/bin.mjs --port 7777 --no-browser --base-dir "$smoke_dir/home" > server.log 2>&1 &
server_pid=$!
for _ in $(seq 1 30); do
if grep -q "Listening on http" server.log; then
echo "Server booted."
kill "$server_pid" || true
exit 0
fi
if ! kill -0 "$server_pid" 2>/dev/null; then
echo "Server process exited before becoming ready. Log:"
cat server.log
exit 1
fi
sleep 1
done
echo "Server did not become ready within 30s. Log:"
cat server.log
kill "$server_pid" || true
exit 1
publish:
name: Publish package
needs: pack
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish == true }}
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Vite+
uses: voidzero-dev/setup-vp@313600b80b104eadebb9111787d37a2e83e014ca # v1.17.0
with:
node-version-file: package.json
cache: true
version: "0.2.4"
run-install: false
- name: Install dependencies
run: vp install --frozen-lockfile
- name: Align package versions
if: ${{ inputs.version != '' }}
run: node scripts/update-release-package-versions.ts "${{ inputs.version }}"
- name: Build server package
env:
THREADLINES_POSTHOG_KEY: ${{ secrets.THREADLINES_POSTHOG_KEY }}
THREADLINES_POSTHOG_HOST: ${{ vars.THREADLINES_POSTHOG_HOST }}
THREADLINES_TELEMETRY_ENABLED: ${{ vars.THREADLINES_TELEMETRY_ENABLED }}
run: vp exec vp run --filter @threadlines/server build
- name: Prepare npm package
run: node scripts/prepare-server-npm-package.ts
- name: Apply brand assets
shell: bash
run: |
brand=production
if [ "${{ inputs.dist_tag }}" = "nightly" ]; then brand=nightly; fi
node scripts/apply-web-brand-assets.ts "$brand" release/npm-server/dist/client
- name: Publish to npm
working-directory: release/npm-server
run: npm publish --access public --tag "${{ inputs.dist_tag }}"