Initial public release

This commit is contained in:
BB-fat
2026-06-22 17:36:26 +08:00
commit f1036a860c
289 changed files with 54589 additions and 0 deletions
+154
View File
@@ -0,0 +1,154 @@
name: Release CLI
on:
push:
tags:
- cli-v*
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-cli-${{ github.ref }}
cancel-in-progress: false
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v6
- name: Resolve CLI version
id: version
shell: bash
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
else
VERSION="${GITHUB_REF_NAME#cli-v}"
fi
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag=cli-v${VERSION}" >> "$GITHUB_OUTPUT"
guard:
needs: resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Verify tag matches Cargo.toml workspace version
shell: bash
run: |
set -euo pipefail
CARGO_VERSION="$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
RELEASE_VERSION="${{ needs.resolve.outputs.version }}"
if [ "$CARGO_VERSION" != "$RELEASE_VERSION" ]; then
echo "Cargo.toml version (${CARGO_VERSION}) does not match release version (${RELEASE_VERSION})"
exit 1
fi
echo "Version guard passed: ${RELEASE_VERSION}"
build-cli:
needs: [resolve, guard]
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
archive: tar.gz
- target: aarch64-unknown-linux-musl
os: ubuntu-24.04-arm
archive: tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools (Linux)
if: runner.os == 'Linux'
shell: bash
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build bsk
shell: bash
run: cargo build --release --locked -p bsk --target "${{ matrix.target }}"
- name: Package archive (Unix)
if: matrix.archive == 'tar.gz'
shell: bash
run: |
set -euo pipefail
VERSION="${{ needs.resolve.outputs.version }}"
ARCHIVE="bsk-v${VERSION}-${{ matrix.target }}.tar.gz"
tar -czf "$ARCHIVE" -C "target/${{ matrix.target }}/release" bsk
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
- name: Package archive (Windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
$version = "${{ needs.resolve.outputs.version }}"
$archive = "bsk-v${version}-${{ matrix.target }}.zip"
Compress-Archive -Path "target/${{ matrix.target }}/release/bsk.exe" -DestinationPath $archive -Force
"ARCHIVE=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: bsk-${{ matrix.target }}
path: ${{ env.ARCHIVE }}
if-no-files-found: error
release:
needs: [resolve, build-cli]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Render version.json
shell: bash
run: |
set -euo pipefail
node scripts/render-version-json.mjs \
--version "${{ needs.resolve.outputs.version }}" \
--repo "${{ github.repository }}" \
--server-url "${{ github.server_url }}" \
--branch "${{ github.event.repository.default_branch }}" \
--out dist/version.json
- name: Publish GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.resolve.outputs.tag }}
name: bsk CLI ${{ needs.resolve.outputs.version }}
make_latest: true
generate_release_notes: true
files: |
dist/*.tar.gz
dist/*.zip
dist/version.json
+128
View File
@@ -0,0 +1,128 @@
name: Release Extension
on:
push:
tags:
- ext-v*
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-extension-${{ github.ref }}
cancel-in-progress: false
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v6
- name: Resolve extension version
id: version
shell: bash
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="$(node -p "require('./apps/extension/package.json').version")"
else
VERSION="${GITHUB_REF_NAME#ext-v}"
fi
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag=ext-v${VERSION}" >> "$GITHUB_OUTPUT"
guard:
needs: resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Verify tag matches extension package.json version
shell: bash
run: |
set -euo pipefail
PKG_VERSION="$(node -p "require('./apps/extension/package.json').version")"
RELEASE_VERSION="${{ needs.resolve.outputs.version }}"
if [ "$PKG_VERSION" != "$RELEASE_VERSION" ]; then
echo "apps/extension/package.json version (${PKG_VERSION}) does not match release version (${RELEASE_VERSION})"
exit 1
fi
echo "Version guard passed: ${RELEASE_VERSION}"
build-extension:
needs: [resolve, guard]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build extension zip
run: pnpm ext:build:zip
- name: Locate and rename extension zip
shell: bash
run: |
set -euo pipefail
VERSION="${{ needs.resolve.outputs.version }}"
ZIP=""
for dir in apps/extension/dist apps/extension/.output; do
if [ ! -d "$dir" ]; then
continue
fi
candidate="$(find "$dir" -maxdepth 1 -name '*chrome*.zip' -type f 2>/dev/null | head -n 1 || true)"
if [ -n "$candidate" ]; then
ZIP="$candidate"
break
fi
done
if [ -z "$ZIP" ]; then
echo "Could not find extension zip under apps/extension/dist or apps/extension/.output"
find apps/extension -name '*.zip' -type f || true
exit 1
fi
OUT="browser-skill-extension-v${VERSION}-chrome.zip"
cp "$ZIP" "$OUT"
echo "ARCHIVE=$OUT" >> "$GITHUB_ENV"
echo "Packaged ${ZIP} -> ${OUT}"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: extension-zip
path: ${{ env.ARCHIVE }}
if-no-files-found: error
release:
needs: [resolve, build-extension]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download build artifact
uses: actions/download-artifact@v8
with:
name: extension-zip
path: dist
- name: Publish GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.resolve.outputs.tag }}
name: BrowserSkill Extension ${{ needs.resolve.outputs.version }}
make_latest: false
generate_release_notes: true
files: dist/*.zip