MichaelHorwitz at pull_request event #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deployment | |
run-name: ${{ github.actor }} at ${{ github.event_name }} event | |
on: | |
workflow_dispatch: | |
# fork: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Make db env file | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_POSTGRES_PASSWORD : ${{ secrets.POSTGRES_PASSWORD }} | |
envkey_POSTGRES_USER : ${{ secrets.POSTGRES_USER }} | |
envkey_POSTGRES_DB : ${{ secrets.POSTGRES_DB }} | |
directory: . | |
file_name: db.env | |
fail_on_empty: false | |
- name: Make api env files | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_DATABASE_URL : ${{ secrets.DATABASE_URL }} | |
envkey_DATABASE_PORT : ${{ secrets.DATABASE_PORT }} | |
envkey_DATABASE_NAME : ${{ secrets.DATABASE_NAME }} | |
envkey_DATABASE_USER : ${{ secrets.DATABASE_USER }} | |
envkey_DATABASE_PASSWORD : ${{ secrets.DATABASE_PASSWORD }} | |
envkey_COMPANY_EMAIL : ${{ secrets.COMPANY_EMAIL }} | |
envkey_COMPANY_AUTH : ${{ secrets.COMPANY_AUTH }} | |
directory: . | |
file_name: api.env | |
fail_on_empty: false | |
- name: Make fe env files | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_API_URL : ${{ secrets.API_URL }} | |
directory: . | |
file_name: fe.env | |
fail_on_empty: false | |
- name: Make red.env file | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_REDIS_PASSWORD : ${{ secrets.REDIS_PASSWORD }} | |
directory: . | |
file_name: red.env | |
fail_on_empty: false | |
- name: Clear Docker Cache | |
run: | | |
docker builder prune -a -f | |
- name: Docker compose build | |
continue-on-error: true | |
run: | | |
cd $GITHUB_WORKSPACE | |
docker compose build --progress=plain | |
docker pull postgres | |
docker pull redis | |
docker pull grafana/loki | |
docker pull prom/prometheus | |
docker pull grafana/grafana | |
docker pull google/cadvisor | |
- name: Make it a tar file | |
continue-on-error: true | |
run: | | |
cd $GITHUB_WORKSPACE | |
docker images | |
docker save -o frontend.tar dispute-resolution-engine-frontend:latest | |
docker save -o api.tar dispute-resolution-engine-api:latest | |
docker save -o postgres.tar postgres:latest | |
docker save -o redis.tar redis:latest | |
docker save -o loki.tar grafana/loki:latest | |
docker save -o prom.tar prom/prometheus:latest | |
docker save -o grafana.tar graphana/grafana:latest | |
docker save -o cadvisor.tar google/cadvisor:latest | |
- name: Set up WireGuard Connection | |
uses: niklaskeerl/easy-wireguard-action@v2 | |
with: | |
WG_CONFIG_FILE: ${{ secrets.WG_CONFIG_FILE }} | |
- name: Send through the docker container using scp | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
source: "api.tar,frontend.tar,postgres.tar,redis.tar,loki.tar,prom.tar,grafana.tar,cadvisor.tar,db.env,api.env,red.env,fe.env,server_compose.yaml" | |
target: ./ | |
timeout: 3m | |
overwrite: true | |
- name: Spin up docker image | |
uses: appleboy/[email protected] | |
continue-on-error: true | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
mv server_compose.yaml compose.yaml | |
docker load -i frontend.tar | |
docker load -i api.tar | |
docker load -i postgres.tar | |
docker load -i redis.tar | |
docker load -i loki.tar | |
docker load -i prom.tar | |
docker load -i grafana.tar | |
docker load -i cadvisor.tar | |
docker compose down | |
docker compose up -d | |
# cypress-test: | |
# container: | |
# image: cypress/included | |
# needs: deploy | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout Repo | |
# uses: actions/checkout@v4 | |
# - name: Cypress run | |
# uses: cypress-io/github-action@v2 | |
# with: | |
# wait-on: 'http://capstone-dre.dns.net.za' | |
# wait-on-timeout: 300 | |
# - name: Upload coverage reports to Codecov | |
# uses: codecov/[email protected] | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} |