on: [push]

jobs:
  build_site:
    name: Generate Site
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v4
      - name: Build files
        uses: Pagwin-Fedora/psb@v1.2
      - name: Upload site as artifact
        # needed for the url thingy later
        id: deployment
        uses: actions/upload-pages-artifact@v3
        with:
          path: publish/

  deploy_site:
    name: Publish Site
    needs: build_site

    # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
    permissions:
      pages: write      # to deploy to Pages
      id-token: write   # to verify the deployment originates from an appropriate source
    
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    
    runs-on: ubuntu-latest
    steps:
    - name: Publish to Github pages
      uses: actions/deploy-pages@v4
