-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (81 loc) · 3.11 KB
/
knowledge-manager.yml
File metadata and controls
92 lines (81 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Deploy Knowledge Manager UI
on:
push:
branches:
- main
jobs:
build:
if: ${{ vars.ENABLE_DEPLOYMENT == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
# Create the environment file for Angular
- name: Create Environment File
run: |
echo "export const environment = {
production: true,
backendUrl: '/api',
angelosAppApiKey: '${{ secrets.ANGELOS_APP_API_KEY }}'
};" > knowledge-manager-ui/src/environments/environment.prod.ts
- name: Verify Environment File Creation
run: |
if [ -f knowledge-manager-ui/src/environments/environment.prod.ts ]; then
echo "Environment file created successfully."
else
echo "Environment file creation failed." && exit 1
fi
- 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 Knowledge Manager Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64, linux/arm64
file: knowledge-manager-ui/Dockerfile
context: knowledge-manager-ui
tags: ghcr.io/ls1intum/angelosai/knowledge-manager:latest
push: true
no-cache: true
deploy:
if: ${{ vars.ENABLE_DEPLOYMENT == 'true' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
# Copy Knowledge Manager Docker Compose to the VM
- name: Copy Knowledge Manager Compose to VM
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: "knowledge-manager-ui/docker-compose.yml"
target: "/home/${{ vars.VM_USERNAME }}/${{ github.repository }}"
- name: SSH to VM and Start Knowledge Manager UI
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: |
cd /home/${{ vars.VM_USERNAME }}/${{ github.repository }}/knowledge-manager-ui
docker compose pull knowledge-manager
docker compose up -d --force-recreate --remove-orphans
docker ps