Skip to content

Merge pull request #728 from HolodexNet/dev #172

Merge pull request #728 from HolodexNet/dev

Merge pull request #728 from HolodexNet/dev #172

name: Deploy to production
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy production box
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script_stop: true
script: |
cd /opt/prod_web || { echo "No directory found"; exit 1; }
git pull origin master
npm ci
npm run build
rm -r /var/www/html/holodex.net/*
cp -r dist/* /var/www/html/holodex.net/
- name: Purge Cloudflare Cache
uses: indiesdev/curl@v1
with:
url: 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache'
method: 'POST'
headers: '{ "X-Auth-Key": "${{ secrets.CLOUDFLARE_PURGE_KEY }}", "X-Auth-Email": "${{ secrets.CLOUDFLARE_AUTH_EMAIL }}", "Content-Type": "application/json" }'
body: '{"files":["https://holodex.net/index.html", "https://holodex.net/sw.js"]}'
timeout: 10000