Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Remove a codeowner (#189) #126

Remove a codeowner (#189)

Remove a codeowner (#189) #126

name: Staging Build and Deploy
on:
push:
branches:
- "master"
paths:
- "**"
- "!README.md"
env:
VIRTUAL_HOST: videoroom.membrane.work
EXTERNAL_IP: 135.181.41.84
TAG: latest
PROJECT: staging
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 staging version
id: docker_build_staging
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.STAGING_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.STAGING_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