Skip to content

Merge pull request #1350 from openworld-community/hotfix/update-hrefl… #29

Merge pull request #1350 from openworld-community/hotfix/update-hrefl…

Merge pull request #1350 from openworld-community/hotfix/update-hrefl… #29

Workflow file for this run

name: 'Deploy prod'
on:
push:
branches:
- prod
workflow_dispatch:
concurrency: build-and-deploy
env:
# Setting an environment variable with the value of a configuration variable
env_var: ${{ vars.ENV_CONTEXT_VAR }}
jobs:
run_pull:
name: run pull
runs-on: ubuntu-latest
steps:
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ vars.PROD_DIR }} && git checkout ${{ vars.PROD_BRANCH }} && git pull"
- name: connect and update traefik
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ vars.PROD_DIR }} && docker compose --compatibility -p ows-events -f docker-compose.traefik.yml up -d --build && exit"
- name: connect and rebuild services
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "export VITE_GOOGLE_OAUTH_KEY=${{ secrets.PROD_GOOGLE_OAUTH_KEY }} && export PEREDELANOCONF_GOOGLEDOC=${{ secrets.PEREDELANOCONF_GOOGLEDOC_ID }} && export VITE_GTAG_ID=${{ secrets.PROD_GTAG_ID }} && export GITHUB_PARSING_TOKEN=${{ secrets.PARSING_TOKEN }} && export SECRET_KEY=${{ secrets.BACKEND_SECRET_KEY }} && export VITE_TELEGRAM_AUTH_BOT_NAME=${{ vars.PROD_AUTH_TELEGRAM_BOT_NAME }} && cd ${{ vars.PROD_DIR }} && docker compose --compatibility -p ows-events_prod -f docker-compose.prod.yml up -d --force-recreate --build && exit"
- name: cleanup
run: rm -rf ~/.ssh