Merge pull request #100 from glencoden/staging #11
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
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy-prod: | |
runs-on: ubuntu-latest | |
steps: | |
- name: copy ssh key | |
run: | | |
mkdir -p ~/.ssh | |
echo -e "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config | |
- name: pull wolke repository and run docker | |
run: | | |
ssh root@${{ secrets.SERVER_ADDRESS_PROD }} <<"ENDSSH" | |
mkdir -p /root/apps/wolke | |
cd /root/apps/wolke | |
git pull || git clone -b main --single-branch git@github.com:glencoden/wolke.git ./ | |
echo "${{ secrets.ENV_LIVE }}" > .env | |
echo "${{ secrets.ENV_PROD }}" > .env.prod | |
cat .env.prod >> .env | |
docker compose down --rmi local | |
docker compose up -d --build | |
docker system prune -f | |
ENDSSH | |
- name: init and remove database as listed in .env | |
run: | | |
ssh root@${{ secrets.SERVER_ADDRESS_PROD }} <<"ENDSSH" | |
cd /root/apps/wolke | |
bash scripts/init-database.sh | |
ENDSSH |