Skip to content

MichaelHorwitz at workflow_dispatch event #63

MichaelHorwitz at workflow_dispatch event

MichaelHorwitz at workflow_dispatch event #63

Workflow file for this run

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: Tar the repo
run: |
cd $GITHUB_WORKSPACE
mkdir temp
rsync -a . ./temp
tar -czpvf archive.tar.gz -C ./temp .
continue-on-error: true
- name: Ensure Tarball exists
run: |
cd $GITHUB_WORKSPACE
ls
continue-on-error: true
- 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: "archive.tar.gz"
target: ./
timeout: 3m
overwrite: true
- name: Spin up docker image
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
mkdir extTemp
tar -xzvf archive.tar.gz -C extTemp
sudo rsync -av --delete extTemp ./
rm -rf extTemp archive.tar.gz
docker compose down
docker builder prune -a -f
docker compose build --progress=plain
docker compose up -d