generated file: .github/workflows/ci.yml
#2
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
| name: Deploy to Production | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Build Docker image | |
| run: docker build -t streamlined-digital-library-backend:latest . | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| - name: Push Docker image to Docker Hub | |
| run: docker push streamlined-digital-library-backend:latest | |
| - name: Deploy to Heroku | |
| uses: akhileshns/heroku-deploy@v3 | |
| with: | |
| heroku_app_name: streamlined-digital-library-production | |
| heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | |
| docker_image: streamlined-digital-library-backend:latest | |
| - name: Run database migrations | |
| run: heroku run python src/infrastructure/database/migrations/alembic/upgrade head -a streamlined-digital-library-production |