Merge pull request #83 from scamper07/feature/refactor #43
This file contains hidden or 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
| # This workflow will build, test and deploy to development and production environments | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| DeployToDev: | |
| name: Deploy to development | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| environment: development | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.10'] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@main | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up virtual environment | |
| run: make setup-venv | |
| - name: Set up Python packages | |
| run: make setup | |
| - name: Run linter | |
| run: make lint | |
| - name: Run Tests | |
| run: make test | |
| - name: Deploy | |
| run: echo Bot deployed! | |
| DeployToProd: | |
| name: Deploy to production | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| runs-on: self-hosted | |
| environment: production | |
| steps: | |
| - name: Deploy | |
| run: echo Deploying to Production environment | |
| - uses: actions/checkout@v3 | |
| - name: Rebuild and start container | |
| run: | | |
| docker-compose up -d --build --force-recreate bro | |
| env: | |
| DISCORD_BOT_TOKEN: ${{secrets.DISCORD_BOT_TOKEN}} | |