-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (42 loc) · 1.57 KB
/
build-push.yml
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
name: Build and Push
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to NCP Container Registry
uses: docker/[email protected]
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/nextjs-fe:${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/nextjs-fe:${{ github.sha }}
cache-to: type=inline
- name: change docker image name
run: |
sed -i 's|image: k8s-registry-test.kr.ncr.ntruss.com/nextjs-fe:.*$|image: ${{ secrets.NCP_CONTAINER_REGISTRY }}/nextjs-fe:${{ github.sha }}|' fe/fe-deployment.yaml
git config --global user.name "${{ secrets.GIT_USERNAME }}"
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git add fe
git status
git commit -m "change docker image name"
- name: Push changes to main branch # merge 내용들을 main 브랜치로 최종 push
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}