---
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
        with:
          submodules: true
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - run: npm install -g bnycdn
      - name: Setup Hugo
        uses: https://guardianproject.dev/actions/actions-hugo@v3
        with:
          hugo-version: '0.154.3'
          extended: true
      - run: wget https://github.com/sass/dart-sass/releases/download/1.97.3/dart-sass-1.97.3-linux-x64.tar.gz -O dart-sass.tar.gz
      - run: tar zxf dart-sass.tar.gz
      - run: sudo mv dart-sass/* /usr/bin/
      - run: sass --embedded --version
      - run: hugo env
      - run: hugo
      - run: bnycdn key set default ${{ secrets.BUNNY_API }}
      - run: bnycdn key set unionstmgmt ${{ secrets.BUNNY_FTP_PASSWORD }} --type=storages
      - run: bnycdn cp -R -s unionstmgmt ./public /unionstmgmt/
      - run: bnycdn pz purge -t unionstmgmt
