Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/devfactory-homepage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: ๐Ÿš€ DevFactory Homepage Deploy
run-name: ๐Ÿš€ Deploying to Production by @${{ github.actor }}

on:
push:
branches:
- main
paths:
- 'platform/**'
- '.github/workflows/devfactory-homepage.yml'
# push:
# branches:
# - main
# paths:
# - 'platform/**'
# - '.github/workflows/devfactory-homepage.yml'
workflow_dispatch:

# ๊ฐ™์€ ๋ธŒ๋žœ์น˜ ๋™์‹œ ์‹คํ–‰ ์‹œ ์ด์ „ ์žก ์ทจ์†Œ(๊ฒฝ์Ÿ ๋ฐฐํฌ ๋ฐฉ์ง€)
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/k8s/ci-homepage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI - Homepage (K8s)

on:
push:
branches: [ "main" ]
paths:
- 'platform/**'
- '.github/workflows/k8s/ci-homepage.yml'
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME_PREFIX: pseudo-lab/devfactory

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- component: homepage-frontend
context: ./platform/frontend
image: homepage-frontend
- component: homepage-backend
context: ./platform/server
image: homepage-backend

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_PREFIX }}-${{ matrix.image }}
tags: |
type=sha,prefix=sha-,format=short
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy-handoff:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout Ops Repository
uses: actions/checkout@v4
with:
repository: Pseudo-Lab/DevFactory-Ops
token: ${{ secrets.OPS_REPO_TOKEN }}
path: ops-repo

- name: Setup Kustomize
uses: imranismail/setup-kustomize@v2

- name: Update Image Tags in Ops Repo
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
cd ops-repo/services/homepage/overlays/prod
kustomize edit set image ghcr.io/pseudo-lab/devfactory-homepage-backend=ghcr.io/pseudo-lab/devfactory-homepage-backend:sha-$SHORT_SHA
kustomize edit set image ghcr.io/pseudo-lab/devfactory-homepage-frontend=ghcr.io/pseudo-lab/devfactory-homepage-frontend:sha-$SHORT_SHA

- name: Commit and Push to Ops Repo
run: |
cd ops-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore(deploy): update homepage images to sha-${{ github.sha }}" || echo "No changes to commit"
git push
Loading