-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.73 KB
/
open-api-docs-ci-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
name: Open API Docs CI/CD
on:
push:
branches:
- 'master'
jobs:
deploy:
environment: production
name: Deploy docs
runs-on: ubuntu-latest
services:
npm:
image: node:9.11.1
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build documentation
run: |
npm install
npm run docs:build
- name: Setup SSH connection
run: |
eval $(ssh-agent -s)
echo "${{ secrets.PRODUCTION_KEY }}" > deploy_key
chmod 600 ./deploy_key
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan ${{ env.PRODUCTION_HOST }} >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: Update files
run: rsync -avzhO --no-p --no-g --delete -e "ssh -i ./deploy_key" public/ ${{ env.PRODUCTION_USER }}@${{ env.PRODUCTION_HOST }}:/var/www/html/docs.openfuture.io/
- name: Update SSL certificate
run: |
ssh -i ./deploy_key ${{ env.PRODUCTION_USER }}@${{ env.PRODUCTION_HOST }} "
docker run --rm --name certbot \
-v /etc/letsencrypt:/etc/letsencrypt \
-v /var/www/certbot:/var/www/certbot \
-v /var/log/letsencrypt:/var/log/letsencrypt \
certbot/certbot \
certonly --webroot -w /var/www/certbot/ \
-d docs.openfuture.io \
--renew-by-default -m [email protected] --eff-email --agree-tos --manual-public-ip-logging-ok
"
ssh -i ./deploy_key ${{ env.PRODUCTION_USER }}@${{ env.PRODUCTION_HOST }} "
sudo service nginx reload"