-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (40 loc) · 1.51 KB
/
deploy.yml
File metadata and controls
43 lines (40 loc) · 1.51 KB
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
name: Build, push and deploy on push to master
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set environment
run: echo "::set-env name=MINITWIT_ENV::production"
- name: Log into dockerhub
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Download docker build cache
run: ./doc.sh pull webapp
- name: Build with docker compose
run: ./doc.sh build
- name: Push docker images to docker hub
run: ./doc.sh push
- name: Configure deployment credentials
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_HOST }}
name: devops_rsa
config: |
Host ${{ secrets.SSH_USERNAME }}
IdentityFile ~/.ssh/devops_rsa
# Deploy
- name: Deploy to Production
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
user: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
command: |
cd devoops
git pull
./deploy.sh