Skip to content

ci cd pipeline pleeease #6

ci cd pipeline pleeease

ci cd pipeline pleeease #6

Workflow file for this run

name: Deploy Angelos
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push to GitHub Container Registry
uses: docker/build-push-action@v6
with:
platforms: amd64, arm64
file: ./Dockerfile
context: .
tags: ghcr.io/ls1intum/angelos:latest
push: true
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Copy Docker Compose File From Repo to VM Host
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
source: "./docker-compose.yml"
target: /home/${{ vars.VM_USERNAME }}/${{ github.repository }}
- name: Copy Docker Compose File for weaviate From Repo to VM Host
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
source: "./docker/weaviate.yml"
target: /home/${{ vars.VM_USERNAME }}/${{ github.repository }}
- name: Copy env file File for weaviate From Repo to VM Host
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
source: "./docker/weaviate/default.env"
target: /home/${{ vars.VM_USERNAME }}/${{ github.repository }}
- name: SSH to VM and create .env.prod
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
script: |
rm /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
touch /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "WEAVIATE_URL=${{ secrets.WEAVIATE_URL }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "WEAVIATE_PORT=${{ secrets.WEAVIATE_PORT }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "KNOWLEDGE_BASE_FOLDER=${{ secrets.KNOWLEDGE_BASE_FOLDER }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "QA_FOLDER=${{ secrets.QA_FOLDER }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "DELETE_BEFORE_INIT=${{ secrets.DELETE_BEFORE_INIT }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "USE_OLLAMA=${{ secrets.USE_OLLAMA }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "USE_AZURE=${{ secrets.USE_AZURE }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "OLLAMA_URL=${{ secrets.OLLAMA_URL }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "EMBED_MODEL=${{ secrets.EMBED_MODEL }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "OPENAI_EMBEDDING_MODEL=${{ secrets.OPENAI_EMBEDDING_MODEL }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "API_KEY=${{ secrets.LLAMA_MODEL_TOKEN }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "URL=${{ secrets.LLAMA_MODEL_URI }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "GPU_USER=${{ secrets.GPU_USER }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "GPU_PASSWORD=${{ secrets.GPU_PASSWORD }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "OPENAI_MODEL=${{ secrets.OPENAI_MODEL }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "GPU_MODEL=${{ secrets.OLLAMA_MODEL }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "GPU_HOST=${{ secrets.GPU_HOST }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "TEST_MODE=${{ secrets.TEST_MODE }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "OPENAI_MODEL_DEPLOYMENT=${{ secrets.OPENAI_MODEL_DEPLOYMENT }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "COHERE_API_KEY=${{ secrets.COHERE_API_KEY }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "COHERE_API_KEY_MULTI=${{ secrets.COHERE_API_KEY_MULTI }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
echo "COHERE_API_KEY_EN=${{ secrets.COHERE_API_KEY_EN }}" >> /home/${{ vars.VM_USERNAME }}/${{ github.repository }}.env.prod
- name: SSH to VM and Execute Docker-Compose Up
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
script: |
docker compose -f /home/${{ vars.VM_USERNAME }}/${{ github.repository }}/docker-compose.yml -f /home/${{ vars.VM_USERNAME }}/${{ github.repository }}/docker/weaviate.yml --env-file=.env.prod up --pull=always -d