Skip to content

Commit

Permalink
Add conditional check for deployment on main branch in pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-lymar committed May 17, 2024
1 parent ca7fbc1 commit 5de6704
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DATABASE_NAME='db_name'
DATABASE_USER='db_user'
DATABASE_PASSWORD='db_password'
DATABASE_HOST='db'
DATABASE_PORT='5432'
DATABASE_PORT=5432

# Django secret key
SECRET_KEY = 'django-insecure-your_secret_key'
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check
name: CI/CD

on: push

Expand All @@ -14,7 +14,6 @@ jobs:
run: ruff check .
- name: Lint Flake8
run: flake8 .

types:
runs-on: ubuntu-latest
steps:
Expand All @@ -24,7 +23,6 @@ jobs:
run: pip install -r requirements.txt
- name: Check types
run: mypy .

test:
runs-on: ubuntu-latest
needs: [lint, types]
Expand Down Expand Up @@ -85,6 +83,7 @@ jobs:
build:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Copy repository contents via scp
Expand Down Expand Up @@ -133,4 +132,4 @@ jobs:
key: ${{ secrets.SSHKEY }}
script: |
cd /var/www/mywebsite
docker-compose up -d
docker-compose up -d --build

0 comments on commit 5de6704

Please sign in to comment.