ci: add npm release workflow
This commit is contained in:
150
.gitea/workflows/npm-release.yml
Normal file
150
.gitea/workflows/npm-release.yml
Normal file
@@ -0,0 +1,150 @@
|
||||
name: npm release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- '[0-9]*'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: verify
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Install release tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
apt-get update
|
||||
apt-get install -y git curl ca-certificates
|
||||
curl -fsSL https://bun.sh/install | bash -s -- bun-v1.3.13
|
||||
install -m 0755 /root/.bun/bin/bun /usr/local/bin/bun
|
||||
node --version
|
||||
npm --version
|
||||
bun --version
|
||||
|
||||
- name: Clone tagged source
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REPO_URL="${{ gitea.server_url }}/${{ gitea.repository }}.git"
|
||||
AUTH_HEADER="$(printf '%s' '${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}' | base64 -w0)"
|
||||
git -c http.extraHeader="Authorization: Basic $AUTH_HEADER" clone --depth 1 --branch "${{ gitea.ref_name }}" "$REPO_URL" repo
|
||||
git -C repo rev-parse HEAD
|
||||
|
||||
- name: Clone IdentityDB dependency
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REPO_SLUG="${{ gitea.repository }}"
|
||||
REPO_OWNER="${REPO_SLUG%%/*}"
|
||||
IDENTITYDB_URL="${{ gitea.server_url }}/${REPO_OWNER}/IdentityDB.git"
|
||||
AUTH_HEADER="$(printf '%s' '${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}' | base64 -w0)"
|
||||
git -c http.extraHeader="Authorization: Basic $AUTH_HEADER" clone --depth 1 "$IDENTITYDB_URL" IdentityDB
|
||||
git -C IdentityDB rev-parse HEAD
|
||||
|
||||
- name: Build IdentityDB dependency
|
||||
working-directory: IdentityDB
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bun install --frozen-lockfile
|
||||
bun run build
|
||||
|
||||
- name: Verify release tag matches package version
|
||||
working-directory: repo
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG_NAME="${{ gitea.ref_name }}"
|
||||
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
|
||||
|
||||
if [ "$TAG_NAME" = "v$PACKAGE_VERSION" ] || [ "$TAG_NAME" = "$PACKAGE_VERSION" ]; then
|
||||
echo "Release tag $TAG_NAME matches package version $PACKAGE_VERSION"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Tag $TAG_NAME does not match package.json version $PACKAGE_VERSION" >&2
|
||||
exit 1
|
||||
|
||||
- name: Run verify pipeline
|
||||
working-directory: repo
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bun install --frozen-lockfile
|
||||
bun run test
|
||||
bun run check
|
||||
bun run build
|
||||
|
||||
release:
|
||||
name: publish to npm
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
timeout-minutes: 30
|
||||
needs:
|
||||
- verify
|
||||
|
||||
steps:
|
||||
- name: Install release tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
apt-get update
|
||||
apt-get install -y git curl ca-certificates
|
||||
curl -fsSL https://bun.sh/install | bash -s -- bun-v1.3.13
|
||||
install -m 0755 /root/.bun/bin/bun /usr/local/bin/bun
|
||||
node --version
|
||||
npm --version
|
||||
bun --version
|
||||
|
||||
- name: Clone tagged source
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REPO_URL="${{ gitea.server_url }}/${{ gitea.repository }}.git"
|
||||
AUTH_HEADER="$(printf '%s' '${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}' | base64 -w0)"
|
||||
git -c http.extraHeader="Authorization: Basic $AUTH_HEADER" clone --depth 1 --branch "${{ gitea.ref_name }}" "$REPO_URL" repo
|
||||
git -C repo rev-parse HEAD
|
||||
|
||||
- name: Clone IdentityDB dependency
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REPO_SLUG="${{ gitea.repository }}"
|
||||
REPO_OWNER="${REPO_SLUG%%/*}"
|
||||
IDENTITYDB_URL="${{ gitea.server_url }}/${REPO_OWNER}/IdentityDB.git"
|
||||
AUTH_HEADER="$(printf '%s' '${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}' | base64 -w0)"
|
||||
git -c http.extraHeader="Authorization: Basic $AUTH_HEADER" clone --depth 1 "$IDENTITYDB_URL" IdentityDB
|
||||
git -C IdentityDB rev-parse HEAD
|
||||
|
||||
- name: Build IdentityDB dependency
|
||||
working-directory: IdentityDB
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bun install --frozen-lockfile
|
||||
bun run build
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: repo
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bun install --frozen-lockfile
|
||||
|
||||
- name: Build package
|
||||
working-directory: repo
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bun run build
|
||||
|
||||
- name: Publish package to npm
|
||||
working-directory: repo
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
printf '//registry.npmjs.org/:_authToken=%s\n' "$NODE_AUTH_TOKEN" > ~/.npmrc
|
||||
npm publish
|
||||
@@ -34,6 +34,12 @@ bun run check
|
||||
bun run build
|
||||
```
|
||||
|
||||
## Release
|
||||
|
||||
Tagging `vX.Y.Z` or `X.Y.Z` triggers the Gitea npm release workflow under `.gitea/workflows/npm-release.yml`.
|
||||
|
||||
Because BoxBrain currently consumes IdentityDB through the sibling `file:../IdentityDB` dependency during active development, the release workflow clones and builds `IdentityDB` first, then runs BoxBrain install/test/build/publish steps against that prepared sibling checkout.
|
||||
|
||||
## Current status
|
||||
|
||||
The repository now contains the framework core for persona initialization, schedule/status management, conversation orchestration, and a ready-made Grok adapter set. See the implementation plan:
|
||||
|
||||
Reference in New Issue
Block a user