Skip to content

Commit b86808d

Browse files
committed
docs: polish github packages presentation
1 parent 4f4be88 commit b86808d

7 files changed

Lines changed: 296 additions & 200 deletions

File tree

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ COMPOSE_PROJECT_NAME=jobhunter
55

66
# Published Docker images. Use versioned tags for reproducible demos.
77
DOCKERHUB_USERNAME=nguyenson1710
8-
IMAGE_TAG=1.0.4
9-
BACKEND_IMAGE=nguyenson1710/jobhunter-backend:1.0.4
10-
FRONTEND_IMAGE=nguyenson1710/jobhunter-frontend:1.0.4
8+
IMAGE_TAG=1.0.5
9+
BACKEND_IMAGE=nguyenson1710/jobhunter-backend:1.0.5
10+
FRONTEND_IMAGE=nguyenson1710/jobhunter-frontend:1.0.5
1111

1212
# Host ports. If a port is occupied, change it here and update public URLs below.
1313
FRONTEND_PORT=3001

.github/workflows/cd.yml

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CD - Docker Hub Publish
1+
name: CD - Container Publish
22

33
on:
44
push:
@@ -9,6 +9,11 @@ on:
99
env:
1010
BACKEND_IMAGE: jobhunter-backend
1111
FRONTEND_IMAGE: jobhunter-frontend
12+
GHCR_NAMESPACE: jasontm17
13+
14+
permissions:
15+
contents: read
16+
packages: write
1217

1318
jobs:
1419
docker-hub-check:
@@ -55,7 +60,7 @@ jobs:
5560
echo "reason=credentials valid for Docker Hub pull,push" >> "$GITHUB_OUTPUT"
5661
fi
5762
58-
publish:
63+
publish-docker-hub:
5964
name: Publish to Docker Hub
6065
runs-on: ubuntu-latest
6166
needs: docker-hub-check
@@ -148,6 +153,96 @@ jobs:
148153
echo "Frontend image: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.FRONTEND_IMAGE }}"
149154
echo "Tags: ${{ steps.meta-frontend.outputs.tags }}"
150155
156+
publish-ghcr:
157+
name: Publish to GitHub Packages
158+
runs-on: ubuntu-latest
159+
if: >-
160+
github.event_name == 'push' &&
161+
(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ||
162+
startsWith(github.ref, 'refs/tags/v'))
163+
164+
steps:
165+
- name: Checkout
166+
uses: actions/checkout@v4
167+
168+
- name: Set up Docker Buildx
169+
uses: docker/setup-buildx-action@v3
170+
171+
- name: Login to GitHub Container Registry
172+
uses: docker/login-action@v3
173+
with:
174+
registry: ghcr.io
175+
username: ${{ github.actor }}
176+
password: ${{ secrets.GITHUB_TOKEN }}
177+
178+
- name: GHCR metadata (backend)
179+
id: ghcr-meta-backend
180+
uses: docker/metadata-action@v5
181+
with:
182+
images: ghcr.io/${{ env.GHCR_NAMESPACE }}/${{ env.BACKEND_IMAGE }}
183+
tags: |
184+
type=ref,event=branch
185+
type=semver,pattern={{version}}
186+
type=sha,prefix=
187+
flavor: |
188+
latest=true
189+
labels: |
190+
org.opencontainers.image.title=Jobhunter Backend API
191+
org.opencontainers.image.description=Spring Boot API for the Jobhunter IT recruitment platform with JWT auth, RBAC, Flyway migrations, MySQL, Actuator metrics, and local production observability.
192+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
193+
org.opencontainers.image.licenses=MIT
194+
org.opencontainers.image.vendor=Jobhunter
195+
196+
- name: GHCR metadata (frontend)
197+
id: ghcr-meta-frontend
198+
uses: docker/metadata-action@v5
199+
with:
200+
images: ghcr.io/${{ env.GHCR_NAMESPACE }}/${{ env.FRONTEND_IMAGE }}
201+
tags: |
202+
type=ref,event=branch
203+
type=semver,pattern={{version}}
204+
type=sha,prefix=
205+
flavor: |
206+
latest=true
207+
labels: |
208+
org.opencontainers.image.title=Jobhunter Frontend Web
209+
org.opencontainers.image.description=Next.js frontend for the Jobhunter IT recruitment platform with responsive job search, candidate/recruiter/admin workspaces, E2E coverage, and visual regression.
210+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
211+
org.opencontainers.image.licenses=MIT
212+
org.opencontainers.image.vendor=Jobhunter
213+
214+
- name: Build and push backend to GHCR
215+
uses: docker/build-push-action@v6
216+
with:
217+
context: ./backend
218+
push: true
219+
tags: ${{ steps.ghcr-meta-backend.outputs.tags }}
220+
labels: ${{ steps.ghcr-meta-backend.outputs.labels }}
221+
cache-from: type=gha
222+
cache-to: type=gha,mode=max
223+
provenance: true
224+
sbom: true
225+
226+
- name: Build and push frontend to GHCR
227+
uses: docker/build-push-action@v6
228+
with:
229+
context: ./frontend
230+
push: true
231+
tags: ${{ steps.ghcr-meta-frontend.outputs.tags }}
232+
labels: ${{ steps.ghcr-meta-frontend.outputs.labels }}
233+
cache-from: type=gha
234+
cache-to: type=gha,mode=max
235+
provenance: true
236+
sbom: true
237+
238+
- name: GHCR summary
239+
run: |
240+
echo "## GitHub Packages" >> "$GITHUB_STEP_SUMMARY"
241+
echo "Backend tags:" >> "$GITHUB_STEP_SUMMARY"
242+
echo '${{ steps.ghcr-meta-backend.outputs.tags }}' >> "$GITHUB_STEP_SUMMARY"
243+
echo "Frontend tags:" >> "$GITHUB_STEP_SUMMARY"
244+
echo '${{ steps.ghcr-meta-frontend.outputs.tags }}' >> "$GITHUB_STEP_SUMMARY"
245+
151246
verify-tag-build:
152247
name: Verify tag Docker build
153248
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)