Skip to content

✨ test : Gradle Cache 적용 테스트 - 코드 변경 #25

✨ test : Gradle Cache 적용 테스트 - 코드 변경

✨ test : Gradle Cache 적용 테스트 - 코드 변경 #25

Workflow file for this run

name: MAIN CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3 # 최신 버전 사용
# 캐싱 추가
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # 최신 버전 사용
- name: Log in to Google Cloud
uses: google-github-actions/auth@v1 # 최신 버전 사용
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure docker for gcloud
run: gcloud auth configure-docker asia-northeast3-docker.pkg.dev
- name: Build and push Docker image
run: |
docker buildx build --push \
--tag asia-northeast3-docker.pkg.dev/symbolic-yen-441710-h6/practice-main/kafka-user:${{ github.sha }} .
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout deployment repo
uses: actions/checkout@v3 # 최신 버전 사용
with:
repository: kafka-practice/kafka-manifest
path: manifests
token: ${{ secrets.DEPLOY_KEY }}
- name: Update manifest
run: |
sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/symbolic-yen-441710-h6/practice-main/kafka-user:${{ github.sha }}|" manifests/kafka-user/deployment.yaml
- name: Commit and push changes
working-directory: manifests
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add .
git commit -m "Update image to asia-northeast3-docker.pkg.dev/symbolic-yen-441710-h6/practice-main/kafka-user:${{ github.sha }}"
git push