File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push to GHCR
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+
7+ jobs :
8+ build-and-push :
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : read
12+ packages : write
13+
14+ strategy :
15+ matrix :
16+ include :
17+ - name : backend
18+ context : ./backend
19+ dockerfile : ./backend/Dockerfile
20+ image : ghcr.io/${{ github.repository_owner }}/trishul-snmp-backend
21+ - name : frontend
22+ context : ./frontend
23+ dockerfile : ./frontend/Dockerfile
24+ image : ghcr.io/${{ github.repository_owner }}/trishul-snmp-frontend
25+
26+ steps :
27+ - uses : actions/checkout@v4
28+
29+ - name : Load .env into environment
30+ run : |
31+ grep -vE '^\s*#' .env | grep -vE '^\s*$' >> "$GITHUB_ENV"
32+
33+ - name : Login to GHCR
34+ uses : docker/login-action@v3
35+ with :
36+ registry : ghcr.io
37+ username : ${{ github.actor }}
38+ password : ${{ secrets.GITHUB_TOKEN }}
39+
40+ - name : Build and push ${{ matrix.name }} image
41+ uses : docker/build-push-action@v6
42+ with :
43+ context : ${{ matrix.context }}
44+ file : ${{ matrix.dockerfile }}
45+ push : true
46+ tags : |
47+ ${{ matrix.image }}:latest
48+ ${{ matrix.image }}:${{ env.APP_VERSION }}
49+
You can’t perform that action at this time.
0 commit comments