Skip to content

fix :: 버전 이슈 해결 #23

fix :: 버전 이슈 해결

fix :: 버전 이슈 해결 #23

Workflow file for this run

name: Build and Deploy to Kubernetes
on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/danuri-team/bmo
jobs:
build:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
outputs:
image-tag: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=,format=short
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Get version
id: image
run: |
VERSION=$(echo ${{ github.sha }} | cut -c1-7)
echo VERSION=$VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: danuri-team
repositories: Danuri-Devops
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
- name: Checkout kustomize repository
uses: actions/checkout@v4
with:
repository: danuri-team/danuri-devops
ref: main
token: ${{ steps.generate-token.outputs.token }}
path: danuri-devops
- name: Update Kubernetes resources
run: |
cd danuri-devops/bmo/
kustomize edit set image ${{ env.IMAGE_NAME }}:${{ steps.image.outputs.version }}
cat kustomization.yaml
- name: Commit files
run: |
cd danuri-devops
git config --global user.email "${{ vars.APP_ID }}+danuri-deploy[bot]@users.noreply.github.com"
git config --global user.name "danuri-deploy[bot]"
git commit -am "chore(bmo): update image to ${{ steps.image.outputs.version }}"
git push -u origin main