-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (63 loc) · 2.17 KB
/
deploy-notification-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
name: Deploy Woorimap-Notification develop env
on:
pull_request:
branches:
- develop
types:
- closed
permissions:
contents: read
jobs:
build:
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'notification')) }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
token: ${{secrets.GIT_TOKEN}}
submodules: true
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean woorimap-notification:build
## docker build & push to develop
- name: Docker build & push to dev
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f ./woorimap-notification/Dockerfile -t ${{ secrets.DOCKER_REPO }}/woorimap-notification ./woorimap-notification
docker push ${{ secrets.DOCKER_REPO }}/woorimap-notification
## deploy to develop
- name: Deploy to dev
uses: appleboy/ssh-action@master
id: deploy-dev
with:
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
docker rm -f woorimap-notification
docker-compose pull notification
docker-compose up -d notification
docker image prune -f
- name: Slack alarm
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Github Action Result
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()