-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (64 loc) · 1.81 KB
/
deploy.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
on:
push:
branches:
- develop
- chore/ci-cd #tmp
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
- name: Temporarily save build artifact
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: build
retention-days: 1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: build
env:
REPO: ${{ secrets.DOCKER_REPO }}
steps:
- uses: actions/checkout@v2
- name: Retrieve built
uses: actions/download-artifact@v2
with:
name: build-artifact
path: build
- name: Docker Hub Sign-in
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Building Docker Image
run: docker build -t $REPO:latest -t $REPO:${GITHUB_RUN_ID} .
- name: Push Docker Image
run: docker push $REPO
deploy:
runs-on: ubuntu-latest
needs: docker
name: Deploy
steps:
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: ${{ secrets.SCRIPT_PATH }}