Skip to content

purge

purge #1050

Workflow file for this run

name: Deploy
concurrency:
cancel-in-progress: true
group: staging # TODO stage/prod separate
on:
push:
jobs:
Build:
uses: ./.github/workflows/build.yml
with:
hugo_env: staging # TODO stage/prod
Deploy:
runs-on: ubuntu-latest
environment: staging # TODO stage/prod
needs: Build
steps:
- name: Download HTML
uses: actions/download-artifact@v3
with:
name: html
path: html
- name: Setup SSH
uses: shimataro/ssh-key-action@v2
with:
key: "${{ secrets.SSH_PRIVATE_KEY }}"
known_hosts: "${{ vars.SSH_KNOWN_HOSTS }}"
- name: Rsync
env:
SSH_HOST: "${{ vars.SSH_HOST }}"
SSH_USER: "${{ secrets.SSH_USER }}"
run: rsync -rptcivh --delete-after --stats ./html/ "$SSH_USER@$SSH_HOST:/home/public"
- name: Purge Cloudflare Cache
env:
CF_AUTH: "Authorization: Bearer ${{ secrets.CF_API_TOKEN }}"
CF_URL: "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/purge_cache"
run: curl -f "$CF_URL" -H "$CF_AUTH" --data '{"purge_everything":true}'