name: Hugo
on: [push]
permissions:
  contents: read
  pages: write
  id-token: write
jobs:
  build:
    runs-on: ubuntu-latest
    container: 
      image: docker://git.korhonen.cc/functionalhacker/hugo-asciidoc-docker-ci:latest
      volumes:
        - './public:/public'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - run: npm install
      - run: hugo --gc --minify -d /public

  deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v2
        with:
          path: './public'
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
