---
name: ci
on:
  push:
    branches:
      - main

jobs:
  build_and_publish:
    runs-on: docker
    container:
      image: ghcr.io/catthehacker/ubuntu:runner-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: sudo apt update && sudo apt install -y hugo
      - run: hugo build
      - run: npm install -g bnycdn
      - run: bnycdn key set default ${{ secrets.BUNNY_API }}
      - run: bnycdn key set sr2pro ${{ secrets.BUNNY_FTP_PASSWORD }} --type=storages
      - run: bnycdn cp -R -s sr2pro ./public /sr2pro/
      - run: bnycdn pz purge -t www.sr2pro.uk
