Deploy Dev #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Dev | |
on: | |
workflow_dispatch: | |
inputs: | |
model_name: | |
required: true | |
description: Model supported by sentence-transformers such as intfloat/e5-large-v2, sentence-transformers/all-MiniLM-L6-v2, sentence-transformers/all-mpnet-base-v2 | |
memory_size: | |
required: true | |
description: Memory size of the lambda function | |
normalize_embeddings: | |
description: Enabled normalize embeddings by specify any value, otherwise leave it blank | |
jobs: | |
deploy-dev: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup NodeJS 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Serverless Framework | |
run: npm install -g serverless | |
- name: Serverless AWS authentication | |
run: sls config credentials --provider aws --key ${{ secrets.AWS_KEY }} --secret ${{ secrets.AWS_SECRET }} | |
- name: Deploy Lambda functions | |
run: > | |
SERVICE=$(echo "${{ github.event.inputs.model_name }}" | cut -d'/' -f2) | |
MODEL=${{ github.event.inputs.model_name }} | |
MEMORY_SIZE=${{ github.event.inputs.memory_size }} | |
NORMALIZE_EMBEDDINGS=${{ github.event.inputs.normalize_embeddings }} | |
sls deploy | |
- name: Export Endpoint URL | |
run: > | |
echo $(SERVICE=$(echo "${{ github.event.inputs.model_name }}" | cut -d'/' -f2) MODEL= MEMORY_SIZE=128 NORMALIZE_EMBEDDINGS= sls info --verbose | | |
grep endpoint | | |
sed s/endpoint\:\ //g | | |
awk '{print $1}') > endpoint | |
- name: Echo Endpoint URL | |
run: echo $(cat endpoint) | |
- name: Test Lambda functions | |
run: "curl -X POST -H 'Content-Type: application/json' -d @text.json $(cat endpoint)v1/embeddings" |