-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 2.83 KB
/
Copy pathci-cd-dev.yml
File metadata and controls
72 lines (60 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI/CD Pipeline
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3 # 최신 버전 사용
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # 최신 버전 사용
- name: Cache Docker layers
uses: actions/cache@v3 # 최신 버전 사용
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Google Cloud
uses: google-github-actions/auth@v1 # 최신 버전 사용
with:
credentials_json: ${{ secrets.ORG_DEV_GCP_CREDENTIALS }}
- name: Configure docker for gcloud
run: gcloud auth configure-docker asia-northeast3-docker.pkg.dev
- name: Build and push Docker image
env:
NEXT_PUBLIC_TOSS_CLIENT_KEY: ${{ secrets.NEXT_PUBLIC_TOSS_CLIENT_KEY }}
NEXT_PUBLIC_TOSS_SECRET_KEY: ${{ secrets.NEXT_PUBLIC_TOSS_SECRET_KEY }}
NEXT_PUBLIC_SERVER_URL: ${{ secrets.NEXT_PUBLIC_SERVER_URL }}
NEXT_PUBLIC_CLIENT_URL: ${{ secrets.NEXT_PUBLIC_CLIENT_URL }} \
run: |
docker buildx build --push \
--build-arg NEXT_PUBLIC_TOSS_CLIENT_KEY=${{ secrets.NEXT_PUBLIC_TOSS_CLIENT_KEY }} \
--build-arg NEXT_PUBLIC_TOSS_SECRET_KEY=${{ secrets.NEXT_PUBLIC_TOSS_SECRET_KEY }} \
--build-arg NEXT_PUBLIC_SERVER_URL=${{ secrets.NEXT_PUBLIC_SERVER_URL }} \
--build-arg NEXT_PUBLIC_CLIENT_URL=${{ secrets.NEXT_PUBLIC_CLIENT_URL }} \
--tag asia-northeast3-docker.pkg.dev/${{ secrets.ORG_DEV_GCP_PROJECT_ID }}/${{ secrets.ORG_DEV_GCP_REGISTRY_NAME }}/flow-nextjs-dev:${{ github.sha }}${{ github.run_attempt }} .
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout deployment repo
uses: actions/checkout@v4.1.7
with:
repository: code-review-platform-flow/flow-manifest
path: manifests
token: ${{ secrets.ORG_GITHUB_KEY }}
- name: Update manifest
run: |
sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/${{ secrets.ORG_DEV_GCP_PROJECT_ID }}/${{ secrets.ORG_DEV_GCP_REGISTRY_NAME }}/flow-nextjs-dev:${{ github.sha }}${{ github.run_attempt }}|" manifests/flow-web-dev/deployment.yaml
- name: Commit and push changes
working-directory: manifests
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add .
git commit -m "Update image to asia-northeast3-docker.pkg.dev/${{ secrets.ORG_DEV_GCP_PROJECT_ID }}/${{ secrets.ORG_DEV_GCP_REGISTRY_NAME }}/flow-nextjs-dev:${{ github.sha }}${{ github.run_attempt }}"
git push