Repository navigation
122 lines (102 loc) ยท 3.33 KB
/
Copy pathbackend-dev.yaml
File metadata and controls
122 lines (102 loc) ยท 3.33 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: backend-dev-CICD
on:
push:
branches:
- "develop"
# ignore path
paths-ignore:
- ".github/workflows/backend-dev-unitest.yaml"
- ".github/workflows/backend-prd.yaml"
- ".github/workflows/frontend-**"
env:
dockerimage_tag: ${{ github.sha }}
dockerimage_name: choisunguk/siat-dev-backend:${{ github.sha }}
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
# 1. git submodule์ ์ด์ฉํด์ ์คํ๋ง๋ถํธ ํ๋กํ์ผ ๋ณต์ฌ
# 2. ์คํ๋ง๋ถํธ ํ๋ก์ ํธ ๋น๋
# 3. docker build
# 4. docker push
steps:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.GITHUBACTION_KEY }}
submodules: 'recursive'
- name: copy springboot profile
run: |
cp ./src/main/resources/CIAT_private/springboot/application-dev.yaml ./src/main/resources/application-dev.yaml
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
- name: gradle build
run: |
gradle clean build --exclude-task test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: copy dockerfile
run: |
rm -rf ./Dockerfile
cp ./cicd/dev/Dockerfile ./Dockerfile
- name: Build and push
id: docker_build
run: |
docker build -t ${{ env.dockerimage_name }} .
docker push ${{ env.dockerimage_name }}
- name: Discord Alert Success
uses: sarisia/actions-status-discord@v1
if: success()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "๐ ํ
์คํธ ๋์์ต๋๋ค!"
- name: Discord Alert Failure
uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "๐ฅ ํ
์คํธ๋ฅผ ์คํจํ์์ต๋๋ค."
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
if: ${{ always() }}
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
update-argocd-metadata:
needs: build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dev/backend
steps:
- uses: actions/checkout@v2
with:
ref: "charts"
ssh-key: ${{ secrets.GITHUBACTION_KEY }}
submodules: 'recursive'
- name: change values-dev.yaml
run: |
cat <<EOF > values-dev.yaml
image:
tag: ${{ env.dockerimage_tag }}
EOF
- name: git push
run: |
git config --global user.email "GitHub Actions Bot@github.com"
git config --global user.name "GitHub Actions Bot"
git add values-dev.yaml
git commit -m "change dockertag"
git pull origin charts
git push origin charts