File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : ["*"]
6+ pull_request :
7+ branches : ["*"]
8+
9+ jobs :
10+ build-and-test :
11+ runs-on : ubuntu-latest
12+
13+ permissions :
14+ contents : read
15+ packages : write
16+
17+ steps :
18+ # Get code
19+ - name : Checkout repository
20+ uses : actions/checkout@v4
21+
22+ # Set up Python
23+ - name : Set up Python
24+ uses : actions/setup-python@v5
25+ with :
26+ python-version : " 3.11"
27+
28+ # Install dependencies
29+ - name : Install dependencies
30+ run : |
31+ python -m pip install --upgrade pip
32+ pip install -r backend/requirements.txt
33+
34+ # Run tests
35+ # - name: Run tests
36+ # run: |
37+ # pytest backend/tests/
38+
39+ # Log in to Github Container Registry
40+ - name : Log in to GHCR
41+ if : github.ref == 'refs/heads/main'
42+ uses : docker/login-action@v3
43+ with :
44+ registry : ghcr.io
45+ username : ${{ github.actor }}
46+ password : ${{ secrets.GITHUB_TOKEN }}
47+
48+ # Build and push Docker image (for main only)
49+ - name : Build and push Docker image
50+ if : github.ref == 'refs/heads/main'
51+ run : |
52+ IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/eventrelay
53+ IMAGE_TAG=${{ github.sha }}
54+
55+ docker build \
56+ -f backend/Dockerfile \
57+ -t $IMAGE_NAME:latest \
58+ -t $IMAGE_NAME:$IMAGE_TAG \
59+ backend
60+
61+ docker push $IMAGE_NAME:latest
62+ docker push $IMAGE_NAME:$IMAGE_TAG
63+
You can’t perform that action at this time.
0 commit comments