This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (48 loc) · 1.83 KB
/
production_build_and_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
name: Production Build and Deploy
on:
push:
tags:
- 'v*.*.*'
env:
DOMAIN: jellyroom.membrane.stream
BE_HOST: server.jellyroom.membrane.stream
PROJECT: production
COMPOSE_FILE_NAME: docker-compose-deploy.yaml
jobs:
deploy1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set versions
id: versions
run: |
cat << EOF >> $GITHUB_OUTPUT
jellyroom=${GITHUB_REF#refs/*/}
jellyfish=$(cat .jellyfish-version)
EOF
- name: Prepare .env file for the deployment
id: variables_population
run: |
echo "DOMAIN=${{env.DOMAIN}}
JELLYROOM_VERSION=${{ steps.versions.outputs.jellyroom }}
JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }}
JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN_CLOUD_PRODUCTION}}
BE_HOST=${{env.BE_HOST}}
BE_JF_SECURE_CONNECTION=true
BE_JF_ADDRESSES=${{vars.JF1_HOST_CLOUD_PRODUCTION}}" > .env
- name: Remove old containers on first host
uses: JimCronqvist/action-ssh@master
with:
hosts: ${{ secrets.PRODUCTION_IP }}:${{ secrets.SSH_PROD_PORT }}
privateKey: ${{ secrets.SSH_PRIV_KEY }}
command: |
docker ps -aq | xargs -r docker stop | xargs -r docker rm
- name: Deploy docker compose to a pre-configured server on first host
uses: TapTap21/[email protected]
with:
remote_docker_host: ${{ secrets.PRODUCTION_IP }}
ssh_private_key: ${{ secrets.SSH_PRIV_KEY }}
ssh_public_key: ${{ secrets.SSH_PUB_KEY }}
ssh_port: ${{ secrets.SSH_PROD_PORT }}
stack_file_name: ${{ env.COMPOSE_FILE_NAME }}
args: -p ${{ env.PROJECT }} --env-file .env up -d --remove-orphans --build frontend backend