Deploy Dev #42
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: Normalize embeddings enabled by default. Disable it by specify "0" or "False" | |
verbose: | |
description: Verbose logging disabled by default. Enabled it by specify any value, otherwise leave it blank | |
jobs: | |
deploy-dev: | |
runs-on: ubuntu-latest | |
env: | |
MODEL: ${{ github.event.inputs.model_name }} | |
MEMORY_SIZE: ${{ github.event.inputs.memory_size }} | |
NORMALIZE_EMBEDDINGS: ${{ github.event.inputs.normalize_embeddings || '1' }} | |
VERBOSE: ${{ github.event.inputs.verbose }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS 18 | |
uses: actions/setup-node@v4 | |
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 | tr '.' '-') | |
sls deploy | |
- name: Export Endpoint URL | |
run: > | |
echo $(SERVICE=$(echo "${{ github.event.inputs.model_name }}" | cut -d'/' -f2 | tr '.' '-') 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 | |
./test.sh $(cat endpoint)v1/embeddings |