-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.03 KB
/
deploy.dev3.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
name: Deploy Backend on Development Environment
on:
workflow_dispatch:
push:
branches:
- main
- deploy/v2-workflow
permissions:
contents: read
env:
IMAGE_NAME: registry.uspray.kr/uspray-server-dev:latest
PROJECT_NAME: uspray-server-dev
DOMAIN_HOST: api.dev.uspray.kr
jobs:
deliver:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
- name: Make gradlew executable
run: chmod +x ./gradlew # Gradle 스크립트 파일에 실행 권한을 부여합니다.
- name: Create application.yml
run: |
mkdir -p ./src/main/resources
cd ./src/main/resources
echo "${{ secrets.APPLICATION }}" >> ./application.yml
- name: Create service-account-file.json
run: |
mkdir -p ./src/main/resources/firebase
cd ./src/main/resources/firebase
echo "${{ secrets.SERVICE_ACCOUNT_FILE }}" | base64 -d > service-account-file.json
- name: Build with Gradle
run: ./gradlew clean build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}
platforms: linux/amd64
deploy:
needs: deliver
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Deploy Docker image
env:
SERVICE_NAME: ${{ env.PROJECT_NAME }}
DOMAIN_HOST: ${{ env.DOMAIN_HOST }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
run: |
if [ ! -z "$(docker ps -q -f name=${{env.PROJECT_NAME}})" ]; then
docker compose -p ${{env.PROJECT_NAME}} down
docker rmi ${{env.IMAGE_NAME}}
fi
docker compose -p ${{env.PROJECT_NAME}} up -d