Merge pull request #1250 from openworld-community/release/2024-07-11 #50
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
name: 'Deploy demo' | |
on: | |
push: | |
branches: | |
- demo | |
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.DEMO_DIR }} && git checkout ${{ vars.DEMO_BRANCH }} && git pull" | |
- name: connect and update traefik | |
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ vars.DEMO_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.DEMO_GOOGLE_OAUTH_KEY }} && export PEREDELANOCONF_GOOGLEDOC=${{ secrets.PEREDELANOCONF_GOOGLEDOC_ID }} && export GITHUB_PARSING_TOKEN=${{ secrets.PARSING_TOKEN }} && export SECRET_KEY=${{ secrets.BACKEND_SECRET_KEY }} && export VITE_TELEGRAM_AUTH_BOT_NAME=${{ vars.DEMO_AUTH_TELEGRAM_BOT_NAME }} && cd ${{ vars.DEMO_DIR }} && docker compose --compatibility -p ows-events_demo -f docker-compose.demo.yml up -d --force-recreate --build && exit" | |
- name: cleanup | |
run: rm -rf ~/.ssh |