Skip to content

Migrate docs to AWS #18

Migrate docs to AWS

Migrate docs to AWS #18

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"