-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.52 KB
/
CD.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
name: CD
on:
push:
branches: [ "develop" ]
jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: create secret config file
run: |
cd src/main/resources
echo "${{ secrets.APPLICATION }}" > ./application.yml
- name: create firebase.json
env:
FIREBASE_SECRET: ${{ secrets.FIREBASE_JSON }}
run: echo $FIREBASE_SECRET > src/main/resources/firebase.json
- name: Verify firebase.json creation
run: |
if [ -f src/main/resources/firebase.json ]; then echo "firebase.json created successfully"; else echo "firebase.json creation failed"; fi
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.REPONAME }}
CD:
needs: [CI]
runs-on: ubuntu-latest
steps:
- name: Docker Image Pull and Container Run
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SERVER_KEY }}
script: |
cd ~
./deploy.sh