This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
96 lines (85 loc) · 2.93 KB
/
sandbox3_build_deploy.yml
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
93
94
95
96
name: Sandbox3 Build and Deploy
on:
push:
branches:
- "sandbox3"
paths:
- "**"
- "!README.md"
env:
VIRTUAL_HOST: videoroom3.membrane.ovh
EXTERNAL_IP: 95.217.155.120
TAG: sandbox3
PROJECT: sandbox
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Declare variables
id: vars
shell: bash
run: |
echo "::set-output name=version::$(git rev-parse --short HEAD)"
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push sandbox version
id: docker_build_sandbox
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: membraneframework/membrane_videoroom:${{ env.TAG }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Prepare .env file for the deployment
id: variables_population
env:
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
GF_SECURITY_ADMIN_PASSWORD: ${{ secrets.GF_SECURITY_ADMIN_PASSWORD }}
GF_SECURITY_ADMIN_USER: ${{ secrets.GF_SECURITY_ADMIN_USER }}
run: |
echo "VIRTUAL_HOST=$VIRTUAL_HOST
EXTERNAL_IP=$EXTERNAL_IP
TAG=$TAG
DB_USERNAME=$DB_USERNAME
DB_PASSWORD=$DB_PASSWORD
GF_SECURITY_ADMIN_PASSWORD=$GF_SECURITY_ADMIN_PASSWORD
GF_SECURITY_ADMIN_USER=$GF_SECURITY_ADMIN_USER" > .env
- name: Remove Grafana and Videoroom containers with volumes
uses: JimCronqvist/action-ssh@master
with:
hosts: ${{ secrets.SANDBOX3_HOST }}
privateKey: ${{ secrets.SSH_PRIV_KEY }}
command: |
docker rm -f ${{ env.PROJECT }}_grafana_1
docker rm -f ${{ env.PROJECT }}_videoroom_1
docker volume rm -f ${{ env.PROJECT }}_grafana-provisioning
- name: Deploy docker compose to a pre-configured server
id: deploy
uses: TapTap21/[email protected]
with:
remote_docker_host: ${{ secrets.SANDBOX3_HOST }}
ssh_private_key: ${{ secrets.SSH_PRIV_KEY }}
ssh_public_key: ${{ secrets.SSH_KNOWN_HOSTS}}
stack_file_name: docker-compose.yml
args: -p ${{ env.PROJECT }} --env-file .env up -d --remove-orphans