-
Notifications
You must be signed in to change notification settings - Fork 4
64 lines (51 loc) · 1.67 KB
/
github-actions-dev.yaml
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
name: BE Dev(Test) Build & Deploy
on:
push:
branches:
# develop 브랜치로 merge되어 push가 트리거 된 경우 실행
- develop
- feat-chatScroll
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Build with Gradle
run: ./gradlew bootJar
- name: Build Docker Image
run: docker build -t ghcr.io/topazkang/be-dev:latest .
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ secrets.GIT_USER }} --password-stdin
- name: Push Docker Image to GHCR
run: docker push ghcr.io/topazkang/be-dev:latest
deploy_test:
runs-on: [ self-hosted, Linux, X64, connectrip_test]
name: Deploy Test API
needs: build
steps:
- name: set env & deploy
run: |
cd /home/ubuntu/deploy/back
echo "${{ secrets.ENV_FILE_TEST }}" > .env
docker image prune -a -f
docker-compose -f docker-compose.back.yaml down
docker-compose -f docker-compose.back.yaml pull
docker-compose -f docker-compose.back.yaml up -d
deploy_dev:
runs-on: [ self-hosted, Linux, X64, connectrip_be_dev ]
name: Deploy Dev API
needs: build
steps:
- name: set env & deploy
run: |
cd /home/ubuntu/deploy/back
echo "${{ secrets.ENV_FILE_DEV }}" > .env
sudo sh switch.sh