Skip to content

reformat of readme

reformat of readme #2

Workflow file for this run

name: Deploy
on:
push:
branches: main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout del repository
uses: actions/checkout@v2
- name: Set ENV variables
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV
- name: Clone or update repository
id: clone_or_update_repo
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DO_SSH_PRIVATE_KEY }}
script: |
if [ ! -d "/etc/docker/tester" ]; then
git clone --recursive https://leoBitto:${{ secrets.GITHUB_TOKEN }}@github.com/leoBitto/tester.git /etc/docker/tester
else
cd /etc/docker/tester
git pull --recurse-submodules origin main
fi
- name: Create config directory and .env file
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DO_SSH_PRIVATE_KEY }}
script: |
mkdir -p config
echo "DEBUG=False" >> config/.env
echo "SECRET_KEY=foo" >> config/.env
echo "DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1] *" >> config/.env
echo "SQL_ENGINE=django.db.backends.postgresql" >> config/.env
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> config/.env
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> config/.env
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> config/.env
echo "SQL_HOST=db" >> config/.env
echo "SQL_PORT=5432" >> config/.env
echo "DATABASE=postgres" >> config/.env
echo "DOMAIN=localhost" >> config/.env
pwd
ls -la
cat ./config/.env
- name: Upgrade server and install docker and stop old container
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DO_SSH_PRIVATE_KEY }}
script: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install docker-ce docker-ce-cli containerd.io -y
sudo apt install docker-compose -y
cd /etc/docker
docker-compose down || true
- name: Avvia i nuovi container
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DO_SSH_PRIVATE_KEY }}
script: |
cd /etc/docker
docker-compose down || true
docker-compose up -d