diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d0c7d86..eb7035b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,40 +29,32 @@ jobs: python -m pip install --upgrade pip pip install flake8==6.0.0 pip install -r ./backend/requirements.txt - - name: Test with flake8 #and django tests - # env: - # POSTGRES_USER: django_user - # POSTGRES_PASSWORD: django_password - # POSTGRES_DB: django_db - # SECRET_KEY: ${{ secrets.SECRET_KEY }} - # DB_HOST: 127.0.0.1 - # DB_PORT: 5432 + - name: Test with flake8 run: | cd backend python -m flake8 - # python manage.py test - # build_backend_and_push_to_docker_hub: - # name: Push Docker image to DockerHub - # runs-on: ubuntu-latest - # needs: tests - # if: github.ref == 'refs/heads/main' - # steps: - # - name: Check out the repo - # uses: actions/checkout@v3 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 - # - name: Login to Docker - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_USERNAME }} - # password: ${{ secrets.DOCKER_PASSWORD }} - # - name: Push to DockerHub - # uses: docker/build-push-action@v4 - # with: - # context: ./backend/ - # push: true - # tags: ${{ secrets.DOCKER_USERNAME }}/kittygram_backend:latest + build_backend_and_push_to_docker_hub: + name: Push Docker image to DockerHub + runs-on: ubuntu-latest + needs: tests + if: github.ref == 'refs/heads/main' + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push to DockerHub + uses: docker/build-push-action@v4 + with: + context: ./backend/ + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/foodgram_backend:latest # frontend_tests: # runs-on: ubuntu-latest