Skip to content

Commit

Permalink
Split workflows into checks and deploy, add prod environment
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamhoyes committed Aug 2, 2021
1 parent 2b38cb6 commit da8d8ee
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Checks

on:
push:
branches:
- '**'

jobs:
checks:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint
run: black --check .
- name: Tests
env:
SECRET_KEY: ${{ secrets.CI_SECRET_KEY }}
run: python manage.py test --settings=app.settings.ci
38 changes: 8 additions & 30 deletions .github/workflows/main.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,19 @@
name: CI/CD
name: Deploy

on:
push:
branches:
- '**'
release:
types:
- 'released'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
STACK_NAME: django-swarm-example

jobs:
checks:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint
run: black --check .
- name: Tests
env:
SECRET_KEY: ${{ secrets.CI_SECRET_KEY }}
run: python manage.py test --settings=app.settings.ci

build:
runs-on: ubuntu-latest
needs: [checks]
if: github.ref == 'refs/heads/master'
outputs:
GITHUB_SHA_SHORT: ${{ steps.sha7.outputs.GITHUB_SHA_SHORT }}

Expand All @@ -62,8 +38,10 @@ jobs:

deploy:
runs-on: ubuntu-latest
needs: [checks, build]
if: github.ref == 'refs/heads/master'
needs: [build]
environment:
name: production
url: https://django-swarm-example.grahamhoyes.com/
defaults:
run:
working-directory: deployment
Expand Down

0 comments on commit da8d8ee

Please sign in to comment.