Skip to content

Commit 667c3d4

Browse files
committed
chore: publish docker latest image on push to main
1 parent 4058f7d commit 667c3d4

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Latest Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
ORG: 'sprintertech'
10+
REGISTRY: 'ghcr.io'
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Checkout the repository
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
# Log in to GHCR
21+
- name: Log in to GHCR
22+
id: ghcr
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
30+
# Build and push the Docker image
31+
- name: Build and push Docker image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
push: true
36+
# Pass build arguments for the GitHub credentials
37+
build-args: |
38+
GH_USER_NAME=${{ secrets.GH_USER_NAME }}
39+
GH_USER_TOKEN=${{ secrets.GHCR_TOKEN }}
40+
tags: |
41+
${{ env.REGISTRY }}/${{ github.repository }}:latest

0 commit comments

Comments
 (0)