diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..9a395f7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,44 @@ +name: Build and Deploy + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m venv venv + venv/bin/pip install -r requirements.txt + - name: Lint and test + run: | + venv/bin/flake8 . + venv/bin/pytest + - name: Deploy the build + id: deploy + uses: Pendect/action-rsyncer@v1.1.0 + env: + DEPLOY_KEY: ${{secrets.DEPLOY_KEY}} + with: + flags: '-avzr --delete' + options: '' + ssh_options: '' + src: 'decidel.ini default_config.py wsgi.py decidel venv' + dest: ${{ secrets.DEPLOY_DESTINATION }} + - name: Display status from deploy + run: echo "${{ steps.deploy.outputs.status }}" + - name: Restart the app + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USERNAME }} + key: ${{ secrets.DEPLOY_KEY }} + script: systemctl restart decidel