File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed
Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI-CD Docker to GHCR
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ workflow_dispatch :
8+
9+ env :
10+ REGISTRY : ghcr.io
11+ IMAGE_NAME : gbadedata/ml-inference-api
12+
13+ jobs :
14+ test :
15+ runs-on : ubuntu-latest
16+
17+ steps :
18+ - name : Check out repository
19+ uses : actions/checkout@v4
20+
21+ - name : Set up Python
22+ uses : actions/setup-python@v5
23+ with :
24+ python-version : " 3.11"
25+
26+ - name : Install dependencies
27+ run : |
28+ python -m pip install --upgrade pip
29+ pip install -r requirements-dev.txt
30+
31+ - name : Run tests
32+ run : pytest
33+
34+ build-and-push :
35+ runs-on : ubuntu-latest
36+ needs : test
37+
38+ permissions :
39+ contents : read
40+ packages : write
41+
42+ steps :
43+ - name : Check out repository
44+ uses : actions/checkout@v4
45+
46+ - name : Log in to GHCR
47+ uses : docker/login-action@v3
48+ with :
49+ registry : ${{ env.REGISTRY }}
50+ username : ${{ github.actor }}
51+ password : ${{ secrets.GITHUB_TOKEN }}
52+
53+ - name : Extract Docker metadata
54+ id : meta
55+ uses : docker/metadata-action@v5
56+ with :
57+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
58+ tags : |
59+ type=raw,value=latest
60+ type=sha
61+
62+ - name : Build and push Docker image
63+ uses : docker/build-push-action@v6
64+ with :
65+ context : .
66+ push : true
67+ tags : ${{ steps.meta.outputs.tags }}
68+ labels : ${{ steps.meta.outputs.labels }}
You can’t perform that action at this time.
0 commit comments