-
Notifications
You must be signed in to change notification settings - Fork 6
88 lines (69 loc) ยท 2.3 KB
/
be-merge-dev.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
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
name: Backend develop CI/CD
on:
workflow_dispatch:
pull_request:
branches: [ develop-BE ]
types: [ closed ]
paths: backend/**
permissions:
contents: read
jobs:
build-and-upload:
if: github.event.pull_request.merged
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_ACCESS_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: ํ
์คํธ ํ๊ฒฝ๋ณ์ ์ค์
run: |
echo "TEST_JWT_SECRET_KEY=${{ secrets.TEST_JWT_SECRET_KEY }}" >> $GITHUB_ENV
echo "TEST_JWT_EXPIRE_LENGTH=${{ secrets.TEST_JWT_EXPIRE_LENGTH }}" >> $GITHUB_ENV
- name: gradlew ์คํ ๊ถํ ๋ถ์ฌ
run: chmod +x gradlew
working-directory: backend
- name: Gradle build ์์
run: ./gradlew clean build
working-directory: backend
- name: Docker buildx ์ค์น
uses: docker/[email protected]
- name: Docker Hub ๋ก๊ทธ์ธ
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_DEV_USERNAME }}
password: ${{ secrets.DOCKERHUB_DEV_TOKEN }}
- name: Docker Image Build
working-directory: backend
run: docker build --platform linux/arm64/v8 -t mapbefine/mapbefine -f Dockerfile-dev .
- name: Docker Hub Push
run: docker push mapbefine/mapbefine
deploy:
if: github.event.pull_request.merged
runs-on: [ self-hosted, dev ]
needs: build-and-upload
steps:
- name: ์ต์ Docker Image ๊ฐ์ ธ์ค๊ธฐ
run: |
sudo docker login --username ${{ secrets.DOCKERHUB_DEV_USERNAME }} --password ${{ secrets.DOCKERHUB_DEV_TOKEN }}
sudo docker pull mapbefine/mapbefine:latest
- name: Docker Compose
run: |
cd /home/ubuntu/backend
sudo sh zero-downtime-deploy.sh
sudo docker image prune -af
- name: ์ฌ๋ ๋ฉ์์ง ๋ณด๋ด๊ธฐ
uses: 8398a7/action-slack@v3
with:
mention: 'here'
if_mention: always
status: ${{ job.status }}
fields: workflow,job,commit,message,ref,author,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()