Skip to content

MichaelHorwitz at pull_request event #79

MichaelHorwitz at pull_request event

MichaelHorwitz at pull_request event #79

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: Create api.env file
run: echo "${{ secrets.API_ENV }}" > api.env
- name: Create fe.env file
run: echo "${{ secrets.FE_ENV }}" > fe.env
- name: Create db.env file
run: echo "${{ secrets.DB_ENV }}" > db.env
- name: Create red.env file
run: echo "${{ secrets.RED_ENV }}" > red.env
- name: Create graf.env file
run: echo "${{ secrets.GRAF_ENV }}" > graf.env
- name: Create .env file
run: echo "${{ secrets.DOCKER_ENV }}" > graf.env
- 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 }}
# extract to a temporary folder for extration
script: |
rm -rf repo
mkdir repo
tar -xzvf archive.tar.gz -C repo
cd repo
docker compose down
docker builder prune -a -f
docker compose build --progress=plain
docker compose up -d