Skip to content

feat(minor): reference common classes on the Llama instance #662

feat(minor): reference common classes on the Llama instance

feat(minor): reference common classes on the Llama instance #662

Workflow file for this run

name: Build
on:
push:
branches:
- master
- beta
pull_request:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- name: Build
run: npm run build
- name: Download latest llama.cpp release
env:
CI: true
run: node ./dist/cli/cli.js source download --release latest --skipBuild --noBundle --noUsageExample --updateBinariesReleaseMetadataAndSaveGitBundle
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "build"
path: "dist"
- name: Upload packed templates artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "build-templates"
path: "templates/packed"
- name: Upload llama.cpp artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "llama.cpp"
path: |
llama/binariesGithubRelease.json
llama/llama.cpp.info.json
llama/llama.cpp
llama/gitRelease.bundle
build-binaries:
name: Build binaries - ${{ matrix.config.name }}
needs:
- build
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "Windows for x64"
os: windows-2019
artifact: "win-x64"
- name: "Windows for Arm"
os: windows-2022
artifact: "win-arm"
- name: "Ubuntu"
os: ubuntu-22.04
artifact: "linux"
- name: "macOS"
os: macos-13
artifact: "mac"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build
path: dist
- name: Download llama.cpp artifact
uses: actions/download-artifact@v4
with:
name: llama.cpp
path: llama
- name: Install dependencies on Windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ninja cmake
- name: Install dependencies on Ubuntu
if: matrix.config.name == 'Ubuntu'
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake libtbb-dev g++-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
which aarch64-linux-gnu-gcc
which aarch64-linux-gnu-g++
which arm-linux-gnueabihf-gcc
which arm-linux-gnueabihf-g++
- name: Install Cuda on Windows for x64
if: matrix.config.name == 'Windows for x64'
uses: Jimver/[email protected]
with:
cuda: '12.2.0'
method: 'network'
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
use-local-cache: false
- name: Install Cuda on Ubuntu
if: matrix.config.name == 'Ubuntu'
uses: Jimver/[email protected]
with:
cuda: '12.2.0'
method: 'network'
- name: Install Vulkan SDK on Windows for x64
if: matrix.config.name == 'Windows for x64'
shell: powershell
env:
VULKAN_VERSION: 1.3.261.1
run: |
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
- name: Install Vulkan SDK on Ubuntu
if: matrix.config.name == 'Ubuntu'
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
sudo apt update
sudo apt install vulkan-sdk
- name: Install dependencies on macOS
if: matrix.config.name == 'macOS'
run: |
brew install cmake ninja
alias make=cmake
- name: Setup & Build
id: build
shell: bash
timeout-minutes: 200
env:
ARTIFACT_NAME: ${{ matrix.config.artifact }}
run: |
npm ci
npx zx -y <<'EOF'
async function getLatestNodeVersions(maxDate) {
const res = await fetch("https://nodejs.org/dist/index.json");
const data = await res.json();
const versions = new Map();
let latestVersion = null;
for (const version of data) {
const majorVersion = Number(version.version.split(".")[0].slice("v".length));
const versionDate = new Date(version.date);
if (maxDate != null && versionDate.getTime() > maxDate)
continue;
if (!versions.has(majorVersion)) {
versions.set(majorVersion, version.version);
}
if (latestVersion === null || majorVersion > latestVersion) {
latestVersion = majorVersion;
}
}
return {versions, latestVersion};
}
const {versions: latestNodeVersions} = await getLatestNodeVersions(Date.now() - 1000 * 60 * 60 * 24 * 14);
const nodeVersion = latestNodeVersions.get(18);
const windowsOnArmNodeVersion = latestNodeVersions.get(20);
if (nodeVersion == null || windowsOnArmNodeVersion == null) {
throw new Error("Could not find node versions");
}
$.verbose = true;
await $`mkdir -p bins`;
async function buildBinary(arch, flags = [], nodeTarget = nodeVersion) {
console.log(`Building ${arch} for node ${nodeTarget} with flags`, flags);
await $`node ./dist/cli/cli.js source build --ciMode --noUsageExample --arch ${arch} --nodeTarget ${nodeVersion} ${flags}`;
}
// build binaries
if (process.env.ARTIFACT_NAME === "win-x64") {
await buildBinary("x64", ["--gpu", "false"]);
await buildBinary("x64", ["--gpu", "cuda"]);
await buildBinary("x64", ["--gpu", "vulkan"]);
} else if (process.env.ARTIFACT_NAME === "win-arm") {
await buildBinary("arm64", ["--gpu", "false"], windowsOnArmNodeVersion);
} else if (process.env.ARTIFACT_NAME === "linux") {
await buildBinary("x64", ["--gpu", "false"]);
await buildBinary("x64", ["--gpu", "cuda"]);
await buildBinary("x64", ["--gpu", "vulkan"]);
await buildBinary("arm64", ["--gpu", "false"]);
await buildBinary("armv7l", ["--gpu", "false"]);
} else if (process.env.ARTIFACT_NAME === "mac") {
await buildBinary("arm64", ["--gpu", "metal"]);
await buildBinary("x64", ["--gpu", "false"]);
}
// move binaries to bins
const localBuildsDirectoryPath = path.join(process.cwd(), "llama", "localBuilds");
const llamaBinsDirectoryPath = path.join(process.cwd(), "bins");
for (const folderName of await fs.readdir(localBuildsDirectoryPath)) {
await fs.move(
path.join(localBuildsDirectoryPath, folderName, "Release"),
path.join(llamaBinsDirectoryPath, folderName)
);
}
await $`echo "Built binaries:"`;
await $`ls bins`;
EOF
# - name: Cache UPX
# id: cache-upx
# uses: actions/cache@v4
# with:
# path: "upxInstallations/**"
# key: cache-upx-${{ runner.os }}-${{ github.workflow }}
# - name: Compress CUDA binary on Windows
# if: matrix.config.name == 'Windows for x64'
# shell: bash
# env:
# UPX_VERSION: 4.2.4
# run: |
# mkdir -p upxInstallations
#
# if [ ! -f "./upxInstallations/upx-${UPX_VERSION}-win64.zip" ]; then
# pushd upxInstallations
# curl -OL "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-win64.zip"
# popd
# fi
#
# mkdir -p upx
# unzip -d ./upx "./upxInstallations/upx-${UPX_VERSION}-win64.zip"
# mv "./upx/upx-${UPX_VERSION}-win64" ./upx/upx
#
# ./upx/upx/upx.exe --best ./bins/win-x64-cuda/Release/ggml.dll
# - name: Compress CUDA binary on Ubuntu
# if: matrix.config.name == 'Ubuntu'
# env:
# UPX_VERSION: 4.2.4
# run: |
# mkdir -p upxInstallations
#
# if [ ! -f "./upxInstallations/upx-${UPX_VERSION}-amd64_linux.tar.xz" ]; then
# pushd upxInstallations
# curl -OL "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz"
# popd
# fi
#
# mkdir -p upx
# tar -xvf "./upxInstallations/upx-${UPX_VERSION}-amd64_linux.tar.xz" -C ./upx
# mv "./upx/upx-${UPX_VERSION}-amd64_linux" ./upx/upx
#
# chmod +x ./bins/linux-x64-cuda/llama-addon.node
# ./upx/upx/upx --best ./bins/linux-x64-cuda/libggml.so
# chmod -x ./bins/linux-x64-cuda/llama-addon.node
- name: Publish artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "bins-${{ matrix.config.artifact }}"
path: "bins/*"
resolve-next-release:
name: Resolve next release
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta')
runs-on: ubuntu-latest
needs:
- build
permissions:
pages: read
id-token: write
contents: read
issues: read
pull-requests: read
discussions: read
outputs:
next-version: ${{ steps.save-next-version.outputs.next-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build
path: dist
- name: Download llama.cpp artifact
uses: actions/download-artifact@v4
with:
name: llama.cpp
path: llama
- name: Apply fix patch on semantic-release, to not check for push permission on dry run
run: |
git apply --ignore-whitespace ./scripts/patches/semantic-release+24.1.1.patch
git apply --ignore-whitespace ./scripts/patches/@semantic-release+npm+12.0.1.patch
- name: Resolve next release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx --no vite-node ./scripts/resolveNextReleaseVersion.ts --saveReleaseToFile ./semanticReleaseDryRunReleaseResult.json --saveVersionToFile ./resolvedNextVersion.txt
- name: Save next version output
id: save-next-version
run: echo "next-version=$(cat ./resolvedNextVersion.txt)" >> $GITHUB_OUTPUT
- name: Update job summary
run: |
if [ "$(cat ./resolvedNextVersion.txt)" == "false" ]; then
echo "Next release version: \`N/A\`" >> $GITHUB_STEP_SUMMARY
else
echo "Next release version: \`$(cat ./resolvedNextVersion.txt)\`" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload resolved release artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "resolved-next-release"
path: "./semanticReleaseDryRunReleaseResult.json"
standalone-tests:
name: Standalone tests
runs-on: ubuntu-22.04
needs:
- build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build
path: dist
- name: Download llama.cpp artifact
uses: actions/download-artifact@v4
with:
name: llama.cpp
path: llama
- name: Install dependencies on ubuntu
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake
- name: Install modules
run: npm ci
- name: Build binary
run: node ./dist/cli/cli.js source build --noUsageExample
- name: Run standalone tests
run: npm run test:standalone
model-dependent-tests:
name: Model dependent tests
runs-on: macos-13
env:
NODE_LLAMA_CPP_GPU: false
needs:
- build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build
path: dist
- name: Download llama.cpp artifact
uses: actions/download-artifact@v4
with:
name: llama.cpp
path: llama
- name: Install dependencies on macOS
run: |
brew install cmake ninja
alias make=cmake
- name: Install modules
run: npm ci
- name: Build binary
run: node ./dist/cli/cli.js source build --noUsageExample
- name: Cache models
id: cache-test-models
uses: actions/cache@v4
with:
path: "test/.models/**.gguf"
key: cache-test-models-${{ runner.os }}-${{ github.workflow }}
- name: Download models or ensure all models are downloaded
run: npm run dev:setup:downloadAllTestModels
- name: Run model dependent tests
run: npm run test:modelDependent
release:
name: Release
if: needs.resolve-next-release.outputs.next-version != '' && needs.resolve-next-release.outputs.next-version != 'false'
runs-on: ubuntu-latest
concurrency: release-${{ github.ref }}
environment:
name: npm
url: ${{ steps.set-npm-url.outputs.npm-url }}
permissions:
id-token: write
contents: write
issues: write
pull-requests: write
discussions: write
needs:
- resolve-next-release
- build
- build-binaries
outputs:
package-version: ${{ steps.set-package-version.outputs.package-version }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: |
mkdir -p bins
mv artifacts/bins-*/* bins/
mv artifacts/build dist/
cp -r artifacts/llama.cpp/llama.cpp/grammars llama/grammars
rm -f ./llama/binariesGithubRelease.json
mv artifacts/llama.cpp/binariesGithubRelease.json ./llama/binariesGithubRelease.json
rm -f ./llama/llama.cpp.info.json
mv artifacts/llama.cpp/llama.cpp.info.json ./llama/llama.cpp.info.json
rm -f ./llama/gitRelease.bundle
mv artifacts/llama.cpp/gitRelease.bundle ./llama/gitRelease.bundle
mv artifacts/build-templates templates/packed/
rm -f ./templates/package.json
rm -f ./templates/package-lock.json
echo "Built binaries:"
ls bins
- name: Move binaries to standalone prebuilt binary modules
run: npx --no vite-node ./scripts/movePrebuiltBinariesToStandaloneModules.ts
- name: Prepare standalone prebuilt binary modules
run: npx --no vite-node ./scripts/prepareStandalonePrebuiltBinaryModules.ts
- name: Add "postinstall" script to package.json
run: npm run addPostinstallScript
- name: Move semanticReleaseDryRunReleaseResult.json artifact
run: mv artifacts/resolved-next-release/semanticReleaseDryRunReleaseResult.json ./semanticReleaseDryRunReleaseResult.json
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_RELEASE_REF: ${{ github.ref }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc
export DRY_RUN_RESULT_FILE_PATH="$(pwd)/semanticReleaseDryRunReleaseResult.json"
git apply --ignore-whitespace ./scripts/patches/@semantic-release+github+11.0.0.patch
npx semantic-release
- name: Set npm package url to GITHUB_OUTPUT
id: set-npm-url
run: |
if [ -f .semanticRelease.npmPackage.deployedVersion.txt ]; then
echo "npm-url=https://www.npmjs.com/package/node-llama-cpp/v/$(cat .semanticRelease.npmPackage.deployedVersion.txt)" >> $GITHUB_OUTPUT
fi
- name: Set package version to GITHUB_OUTPUT
id: set-package-version
run: |
if [ -f .semanticRelease.npmPackage.deployedVersion.txt ]; then
echo "package-version=$(cat .semanticRelease.npmPackage.deployedVersion.txt)" >> $GITHUB_OUTPUT
fi
- name: Prepare `create-node-llama-cpp` module
if: steps.set-npm-url.outputs.npm-url != ''
run: |
export DEPLOYED_PACKAGE_VERSION=$(cat .semanticRelease.npmPackage.deployedVersion.txt)
pushd packages/create-node-llama-cpp
npm ci --ignore-scripts
popd
npx --no vite-node ./scripts/prepareCreateNodeLlamaCppModuleForPublish.ts --packageVersion "$DEPLOYED_PACKAGE_VERSION"
pushd packages/create-node-llama-cpp
npm run build
- name: Release `create-node-llama-cpp` module
if: steps.set-npm-url.outputs.npm-url != ''
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_RELEASE_REF: ${{ github.ref }}
run: |
cd packages/create-node-llama-cpp
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc
if [ "$GH_RELEASE_REF" == "refs/heads/beta" ]; then
npm publish --tag beta
else
npm publish
fi
auto-approve-documentation-website-deployment:
name: Auto-approve documentation website deployment
runs-on: ubuntu-latest
continue-on-error: true
needs:
- release
steps:
- name: Approve documentation website deployment
uses: activescott/[email protected]
with:
github_token: ${{ secrets.AUTO_APPROVAL_GITHUB_TOKEN }}
environment_allow_list: "Documentation website"
actor_allow_list: giladgd
build-electron-example:
name: Build & release Electron app example - ${{ matrix.config.name }}
needs:
- release
if: needs.release.outputs.package-version != ''
runs-on: ${{ matrix.config.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
config:
- name: "Windows"
os: windows-2022
- name: "Ubuntu"
os: ubuntu-22.04
- name: "macOS"
os: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies on Ubuntu
if: matrix.config.name == 'Ubuntu'
run: |
sudo apt-get update
sudo apt-get install libarchive-tools rpm
sudo snap install snapcraft --classic
- name: Install modules
run: npm ci
- name: Create Electron app project
shell: bash
env:
DEPLOYED_PACKAGE_VERSION: ${{ needs.release.outputs.package-version }}
NODE_LLAMA_CPP_SKIP_DOWNLOAD: true
run: |
npx --no vite-node ./scripts/scaffoldElectronExampleForCiBuild.ts --packageVersion "$DEPLOYED_PACKAGE_VERSION" --packageFolderPath ./electron-app-example
cd electron-app-example
npm install
- name: Build electron app
id: build
shell: bash
timeout-minutes: 480
run: |
cd electron-app-example
npm run build
ls ./release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "electron-app-example-${{ matrix.config.name }}"
path: "./electron-app-example/release"
- name: Add builds to current release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ needs.release.outputs.package-version }}
run: |
shopt -s nullglob
for file in ./electron-app-example/release/*.{dmg,zip,exe,appx,AppImage,snap,assert,deb,tar.gz}; do
echo "Adding $file to release $RELEASE_TAG"
gh release upload "v$RELEASE_TAG" "$file"
done
shopt -u nullglob
update-documentation-website:
name: Update documentation website
if: |
always() &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
needs.build.result == 'success' &&
needs.resolve-next-release.result == 'success' &&
needs.resolve-next-release.outputs.next-version != '' &&
needs.resolve-next-release.outputs.next-version != 'false' && (
needs.release.result == 'skipped' || (
needs.release.result == 'success' &&
needs.release.outputs.package-version != ''
)
)
runs-on: ubuntu-latest
concurrency: update-documentation-website-${{ github.ref }}
environment:
name: Documentation website
url: "https://node-llama-cpp.withcat.ai"
permissions:
pages: write
id-token: write
contents: read
needs:
- build
- resolve-next-release
- release
# All steps are copied to `update-documentation-website-no-release` job
# Can be replaced with YAML anchors when this will be supported by GitHub Actions:
# https://github.com/actions/runner/issues/1182#issuecomment-2317953582
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: |
mv artifacts/build dist/
cp -r artifacts/llama.cpp/llama.cpp llama/llama.cpp
rm -f ./llama/binariesGithubRelease.json
mv artifacts/llama.cpp/binariesGithubRelease.json ./llama/binariesGithubRelease.json
rm -f ./llama/llama.cpp.info.json
mv artifacts/llama.cpp/llama.cpp.info.json ./llama/llama.cpp.info.json
- name: Resolve docs version
env:
RELEASE_VERSION: ${{ needs.release.outputs.package-version || needs.resolve-next-release.outputs.next-version }}
run: |
if [ "$RELEASE_VERSION" == "false" ]; then
npx --no vite-node ./scripts/resolveLatestReleaseVersion.ts --saveVersionToFile ./docsVersion.txt
else
echo "$RELEASE_VERSION" > ./docsVersion.txt
fi
- name: Generate docs with updated version
env:
DOCS_URL_BASE: "/"
run: |
export DOCS_PACKAGE_VERSION="$(cat ./docsVersion.txt)"
echo "Package version: $DOCS_PACKAGE_VERSION"
git apply --ignore-whitespace ./scripts/patches/vitepress+1.3.4.patch
npm run docs:build
- name: Upload docs to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
name: pages-docs
path: docs-site
- name: Deploy docs to GitHub Pages
uses: actions/deploy-pages@v4
with:
artifact_name: pages-docs
- name: Update feed
run: |
curl -X POST "https://pubsubhubbub.appspot.com/" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "hub.mode=publish" --data-urlencode "hub.url=https://node-llama-cpp.withcat.ai/blog/feed.atom"
update-documentation-website-no-release:
name: Update documentation website - no version release
if: |
always() &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
needs.build.result == 'success' &&
needs.resolve-next-release.result == 'success' &&
needs.resolve-next-release.outputs.next-version == 'false'
runs-on: ubuntu-latest
concurrency: update-documentation-website-${{ github.ref }}
environment:
name: Documentation website
url: "https://node-llama-cpp.withcat.ai"
permissions:
pages: write
id-token: write
contents: read
needs:
- build
- resolve-next-release
# All steps are copied to `update-documentation-website` job
# Can be replaced with YAML anchors when this will be supported by GitHub Actions:
# https://github.com/actions/runner/issues/1182#issuecomment-2317953582
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: |
mv artifacts/build dist/
cp -r artifacts/llama.cpp/llama.cpp llama/llama.cpp
rm -f ./llama/binariesGithubRelease.json
mv artifacts/llama.cpp/binariesGithubRelease.json ./llama/binariesGithubRelease.json
rm -f ./llama/llama.cpp.info.json
mv artifacts/llama.cpp/llama.cpp.info.json ./llama/llama.cpp.info.json
- name: Resolve docs version
env:
RELEASE_VERSION: ${{ needs.release.outputs.package-version || needs.resolve-next-release.outputs.next-version }}
run: |
if [ "$RELEASE_VERSION" == "false" ]; then
npx --no vite-node ./scripts/resolveLatestReleaseVersion.ts --saveVersionToFile ./docsVersion.txt
else
echo "$RELEASE_VERSION" > ./docsVersion.txt
fi
- name: Generate docs with updated version
env:
DOCS_URL_BASE: "/"
run: |
export DOCS_PACKAGE_VERSION="$(cat ./docsVersion.txt)"
echo "Package version: $DOCS_PACKAGE_VERSION"
git apply --ignore-whitespace ./scripts/patches/vitepress+1.3.4.patch
npm run docs:build
- name: Upload docs to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
name: pages-docs
path: docs-site
- name: Deploy docs to GitHub Pages
uses: actions/deploy-pages@v4
with:
artifact_name: pages-docs
- name: Update feed
run: |
curl -X POST "https://pubsubhubbub.appspot.com/" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "hub.mode=publish" --data-urlencode "hub.url=https://node-llama-cpp.withcat.ai/blog/feed.atom"
# fix-broken-github-release:
# name: Fix broken GitHub release
# if: github.event_name == 'pull_request' && github.head_ref == 'gilad/smallerLogoFile'
# runs-on: ubuntu-latest
# permissions:
# id-token: write
# actions: read
# contents: write
# issues: write
# pull-requests: write
# discussions: write
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: "20"
# - name: Install modules
# run: npm ci
#
# - name: Pull artifact from broken release
# uses: actions/download-artifact@v4
# with:
# name: resolved-next-release
# github-token: ${{ secrets.GITHUB_TOKEN }}
# repository: "${{ github.repository }}"
# run-id: "<run id here>"
# path: scripts/resolved-next-release-artifact
#
# - name: Fix broken release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: npx --no vite-node ./scripts/rerunSemanticReleaseGithubSuccess.ts