Skip to content

add deployment scripts #59

add deployment scripts

add deployment scripts #59

Workflow file for this run

name: CI
on:
workflow_dispatch:
inputs:
create_release:
description: 'Create new release'
required: true
type: boolean
push:
branches:
- main
- stg
paths: ['.github/workflows/**', '**/Makefile', '**/*.go', '**/*.json', '**/*.yml', '**/*.ts', '**/*.js']
pull_request:
types: [opened, reopened, synchronize]
paths: ['.github/workflows/**', '**/Makefile', '**/*.go', '**/*.json', '**/*.yml', '**/*.ts', '**/*.js']
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
Ubuntu-22-x64:
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache-dependency-path: |
launcher/go.sum
proxy-router/go.sum
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ui-desktop/yarn.lock
- name: Install dependencies
run: |
cd launcher
go mod tidy
cd ../proxy-router
go mod download
cd ../ui-desktop
yarn install --network-timeout 600000
- name: Copy Environment Files
uses: ./.github/actions/copy_env_files
- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name
- name: Build
id: build
run: |
cd launcher
make
cd ../proxy-router
make build
cd ../cli
make build
cd ../ui-desktop
yarn build:linux
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-ubuntu-x64.zip"
LLAMACPP=llama-b3256-bin-ubuntu-x64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP build/bin/llama-server
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./ui-desktop-1.0.0-x64-linux.AppImage"]}' > mor-launch.json
mv ./cli/mor-cli mor-cli
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch llama-server ./proxy-router/bin/proxy-router .env $MODEL mor-launch.json ./ui-desktop/dist/ui-desktop-1.0.0-x64-linux.AppImage models-config.json mor-cli
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: mor-launch-${{ env.TAG_NAME }}-ubuntu-x64.zip
name: mor-launch-ubuntu-x64.zip
macOS-13-x64:
runs-on: macos-13
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache-dependency-path: |
launcher/go.sum
proxy-router/go.sum
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ui-desktop/yarn.lock
- name: Install dependencies
run: |
cd launcher
go mod tidy
cd ../proxy-router
go mod download
cd ../ui-desktop
python3 -m pip install setuptools
yarn install --network-timeout 600000
- name: Copy Environment Files
uses: ./.github/actions/copy_env_files
- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name
- name: Build
id: build
run: |
cd launcher
make
cd ../proxy-router
make build
cd ../cli
make build
cd ../ui-desktop
yarn build:mac
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-macos-x64.zip"
LLAMACPP=llama-b3256-bin-macos-x64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP build/bin/llama-server
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./MorpheusUI.app/Contents/MacOS/MorpheusUI"]}' > mor-launch.json
mv ./cli/mor-cli mor-cli
unzip ./ui-desktop/dist/morpheus-ui-1.0.0-x64-mac.zip
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env llama-server $MODEL mor-launch.json models-config.json mor-cli
zip -r $ARTIFACT 'MorpheusUI.app'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: mor-launch-${{ env.TAG_NAME }}-macos-x64.zip
name: mor-launch-macos-x64.zip
macOS-14-arm64:
runs-on: macos-14
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache-dependency-path: |
launcher/go.sum
proxy-router/go.sum
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ui-desktop/yarn.lock
- name: Install dependencies
run: |
cd launcher
go mod tidy
cd ../proxy-router
go mod download
cd ../ui-desktop
brew install python-setuptools
yarn install --network-timeout 600000
- name: Copy Environment Files
uses: ./.github/actions/copy_env_files
- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name
- name: Build
id: build
run: |
cd launcher
make
cd ../proxy-router
make build
cd ../cli
make build
cd ../ui-desktop
yarn build:mac
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-macos-arm64.zip"
LLAMACPP=llama-b3256-bin-macos-arm64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP build/bin/llama-server
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./MorpheusUI.app/Contents/MacOS/MorpheusUI"]}' > mor-launch.json
mv ./cli/mor-cli mor-cli
unzip ./ui-desktop/dist/morpheus-ui-1.0.0-arm64-mac.zip
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env llama-server $MODEL mor-launch.json models-config.json mor-cli
zip -r $ARTIFACT 'MorpheusUI.app'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: mor-launch-${{ env.TAG_NAME }}-macos-arm64.zip
name: mor-launch-macos-arm64.zip
Windows-avx2-x64:
runs-on: windows-latest
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache-dependency-path: |
launcher/go.sum
proxy-router/go.sum
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ui-desktop/yarn.lock
- name: Install wget and sed
run: |
choco install wget --no-progress
choco install sed --no-progress
- name: Install dependencies
run: |
cd launcher
go mod tidy
cd ../proxy-router
go mod download
cd ../ui-desktop
yarn install --network-timeout 600000
- name: Copy Environment Files
uses: ./.github/actions/copy_env_files
- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name
- name: Build
id: build
run: |
cd launcher
make
cd ../proxy-router
make build
cd ../cli
make build
cd ../ui-desktop
yarn build:win
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-win-x64.zip"
LLAMACPP=llama-b3256-bin-win-avx2-x64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP llama-server.exe llama.dll ggml.dll
echo '{"run":["./llama-server.exe -m ./'$MODEL'","./proxy-router.exe","./morpheus-ui-1.0.0-x64-win.exe"]}' > mor-launch.json
mv .env .env.tmp
sed 's|\./data/|.\\data\\|g' .env.tmp > .env
mv ./proxy-router/bin/proxy-router proxy-router.exe
mv ./cli/mor-cli mor-cli.exe
mv ./launcher/mor-launch mor-launch.exe
mv "./ui-desktop/dist/morpheus-ui-1.0.0-x64-win" morpheus-ui-1.0.0-x64-win.exe
7z a $ARTIFACT LICENSE mor-launch.exe proxy-router.exe .env llama-server.exe llama.dll ggml.dll $MODEL mor-launch.json morpheus-ui-1.0.0-x64-win.exe models-config.json mor-cli.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: mor-launch-${{ env.TAG_NAME }}-win-x64.zip
name: mor-launch-win-x64.zip
release:
if: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stg')) || github.event.inputs.create_release == 'true' }}
runs-on: ubuntu-latest
needs:
- Ubuntu-22-x64
- macOS-13-x64
- macOS-14-arm64
- Windows-avx2-x64
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name
- name: Download artifacts
id: download-artifact
uses: actions/download-artifact@v4
with:
path: ./artifact
- name: Move artifacts
id: move_artifacts
run: |
mkdir -p ./artifact/release
mv ./artifact/*/*.zip ./artifact/release
- name: Create release
id: create_release
uses: anzz1/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
prerelease: ${{ github.ref != 'refs/heads/main' }}
- name: Upload release
id: upload_release
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const fs = require('fs');
const release_id = '${{ steps.create_release.outputs.id }}';
for (let file of await fs.readdirSync('./artifact/release')) {
if (path.extname(file) === '.zip') {
console.log('uploadReleaseAsset', file);
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./artifact/release/${file}`)
});
}
}