Add github actions continuous deployment #9
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 | |
on: | |
push: | |
branches: [ development ] | |
pull_request: | |
branches: [ development ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/sfs.key | |
chmod 600 ~/.ssh/sfs.key | |
cat >> ~/.ssh/config << EOF | |
Host sfs | |
HostName 81.95.52.39 | |
User root | |
IdentityFile ~/.ssh/sfs.key | |
StrictHostKeyChecking no | |
EOF | |
env: | |
SSH_KEY: ${{ secrets.SFS_SSH_KEY }} | |
- name: Install Dependencies | |
run: cd ansible/ && pip install -r requirements.txt | |
- name: Test ssh | |
run: ssh sfs cat /etc/issue | |
- name: Run ansible playbook | |
run: cd ansible/ && ansible all -m ping -vvv | |
env: | |
ANSIBLE_HOST: 81.95.52.39 | |
ANSIBLE_USER: ${{ secrets.SFS_ANSIBLE_USER }} | |
DEBUG_MODE: 1 | |
VITE_DEV_MODE: 0 | |
DOMAIN_NAME: sharedfutures.space | |
EMAIL: [email protected] | |
SECRET_KEY: ${{ secrets.SFS_SECRET_KEY }} | |
POSTGRES_PASSWORD: ${{ secrets.SFS_POSTGRES_PASSWORD }} | |
CELERY_BROKER_URL: redis://localhost:6379 | |
CELERY_RESULT_BACKEND: redis://localhost:6379 | |
ENABLE_ALLAUTH_SOCIAL_LOGIN: 1 | |
GOOGLE_CLIENT_ID: ${{ secrets.SFS_GOOGLE_CLIENT_ID }} | |
GOOGLE_SECRET: ${{ secrets.SFS_GOOGLE_SECRET }} | |
EMAIL_HOST: mail.webarch.net | |
EMAIL_HOST_USER: [email protected] | |
EMAIL_HOST_PASSWORD: ${{ secrets.SFS_EMAIL_HOST_PASSWORD }} | |
DEFAULT_FROM_EMAIL: [email protected] | |
WEATHER_API_KEY: ${{ secrets.SFS_WEATHER_API_KEY }} |