691c064a37
- package.json: drop private; point main/types/exports/bin at a tsc-built dist/; add publishConfig (unom/npm registry), files, repo metadata, and the MIT OR Apache-2.0 license; effect becomes a peerDependency (shared instance). - tsconfig.build.json: emit dist/ JS + .d.ts (bun shebang preserved on the bin). - .npmrc: map the @punktfunk scope to the registry (no token committed). - sdk-publish.yml: publish on sdk-v* tags or manual dispatch, reusing the REGISTRY_TOKEN secret; typecheck/test/build/tag-matches-version gate. - README: Install section for consumers. Verified: build green, frozen lockfile stable, bun publish --dry-run packs @punktfunk/host@0.1.0 (dist + README only) to the unom registry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
2.1 KiB
YAML
61 lines
2.1 KiB
YAML
# Publish the TypeScript SDK (@punktfunk/host) to the Gitea npm registry
|
|
# (https://git.unom.io/api/packages/unom/npm/).
|
|
#
|
|
# Trigger: push a tag `sdk-vX.Y.Z` (must equal sdk/package.json "version"), or run manually.
|
|
# The SDK versions independently of the app's `v*` tags, so bumping the host doesn't republish it.
|
|
#
|
|
# Auth: REGISTRY_TOKEN — the same repo Actions secret docker.yml uses (a Gitea PAT with
|
|
# write:package scope). No new secret needed.
|
|
name: sdk-publish
|
|
|
|
on:
|
|
push:
|
|
tags: ['sdk-v*']
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-24.04
|
|
container:
|
|
image: oven/bun:1
|
|
timeout-minutes: 15
|
|
defaults:
|
|
run:
|
|
working-directory: sdk
|
|
steps:
|
|
# oven/bun's slim base ships neither git, a CA bundle, nor node — actions/checkout's HTTPS
|
|
# fetch needs git + ca-certificates, and the version-guard step below uses node.
|
|
- name: Install git + node + CA certs
|
|
working-directory: /
|
|
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git nodejs
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile --ignore-scripts
|
|
|
|
- name: Typecheck
|
|
run: bun run typecheck
|
|
|
|
- name: Test
|
|
run: bun test
|
|
|
|
- name: Build (dist/ JS + .d.ts)
|
|
run: bun run build
|
|
|
|
- name: Tag matches package version
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
TAG="${GITHUB_REF_NAME#sdk-v}"
|
|
PKG="$(node -p "require('./package.json').version")"
|
|
test "$TAG" = "$PKG" || { echo "tag $GITHUB_REF_NAME does not match package version $PKG"; exit 1; }
|
|
|
|
- name: Publish to Gitea registry
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
run: |
|
|
test -n "$NODE_AUTH_TOKEN" || { echo "REGISTRY_TOKEN secret is empty"; exit 1; }
|
|
# .npmrc already maps the @punktfunk scope to the registry; append the auth line.
|
|
printf '//git.unom.io/api/packages/unom/npm/:_authToken=%s\n' "$NODE_AUTH_TOKEN" >> .npmrc
|
|
bun publish
|