|
1 | | -name: 'build and deploy test server' |
| 1 | + |
| 2 | +name: 'Build and Deploy server' |
2 | 3 |
|
3 | 4 | on: |
4 | | - push: |
5 | | - branches: master |
6 | | - workflow_dispatch: |
| 5 | + release: |
| 6 | + types: [ published ] |
7 | 7 |
|
8 | 8 | jobs: |
| 9 | + test: |
| 10 | + name: 'Test before deploy' |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + |
| 15 | + - name: Set up Python 3.9 |
| 16 | + uses: actions/setup-python@v2 |
| 17 | + with: |
| 18 | + python-version: 3.9 |
| 19 | + |
| 20 | + - name: cache poetry install |
| 21 | + uses: actions/cache@v2 |
| 22 | + with: |
| 23 | + path: ~/.local |
| 24 | + key: poetry-1.2.2-0 |
| 25 | + |
| 26 | + - uses: snok/install-poetry@v1 |
| 27 | + with: |
| 28 | + version: 1.2.2 |
| 29 | + virtualenvs-create: true |
| 30 | + virtualenvs-in-project: true |
| 31 | + |
| 32 | + - name: cache deps |
| 33 | + id: cache-deps |
| 34 | + uses: actions/cache@v2 |
| 35 | + with: |
| 36 | + path: .venv |
| 37 | + key: pydeps-${{ hashFiles('**/poetry.lock') }} |
| 38 | + |
| 39 | + - run: poetry install --no-root |
| 40 | + if: steps.cache-deps.outputs.cache-hit != 'true' |
| 41 | + |
| 42 | + - run: poetry run pip install setuptools |
| 43 | + |
| 44 | + - name: Run tests |
| 45 | + run: poetry run python manage.py test |
| 46 | + env: |
| 47 | + DEBUG: True |
| 48 | + |
9 | 49 | build: |
10 | 50 | name: 'Build & Publish' |
11 | 51 | runs-on: ubuntu-latest |
| 52 | + needs: [ test ] |
12 | 53 | steps: |
13 | 54 | - name: "Checkout repository" |
14 | 55 | uses: actions/checkout@v2 |
|
47 | 88 | cache-to: type=gha,mode=max |
48 | 89 | tags: ${{ steps.meta.outputs.tags }} |
49 | 90 | labels: ${{ steps.meta.outputs.labels }} |
50 | | - |
51 | | - run: |
52 | | - runs-on: ubuntu-latest |
53 | | - needs: [ build ] |
54 | | - steps: |
| 91 | + |
55 | 92 | - name: run on server |
56 | 93 | uses: garygrossgarten/github-action-ssh@release |
57 | 94 | with: |
|
78 | 115 | echo "EMAIL_HOST=${{ secrets.EMAIL_HOST }}" >> .env && |
79 | 116 | echo "EMAIL_PORT=${{ secrets.EMAIL_PORT }}" >> .env && |
80 | 117 |
|
81 | | - echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env && |
82 | | -
|
| 118 | + echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env |
| 119 | + |
83 | 120 | docker-compose -f docker-compose.prod-ci.yml -p prod up -d |
| 121 | +
|
0 commit comments