Fix error in ci file #14
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: CI | |
| on: | |
| push: | |
| branches: ["*"] | |
| pull_request: | |
| branches: ["*"] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| # Get code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r backend/requirements.txt | |
| # Run tests | |
| # - name: Run tests | |
| # run: | | |
| # pytest backend/tests/ | |
| # Log in to Github Container Registry | |
| - name: Log in to GHCR | |
| if: github.ref == 'refs/heads/main' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Build and push Docker image (for main only) | |
| - name: Build and push Docker image | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/eventrelay | |
| IMAGE_TAG=${{ github.sha }} | |
| docker build \ | |
| -f backend/Dockerfile \ | |
| -t $IMAGE_NAME:latest \ | |
| -t $IMAGE_NAME:$IMAGE_TAG \ | |
| backend | |
| docker push $IMAGE_NAME:latest | |
| docker push $IMAGE_NAME:$IMAGE_TAG |