Comment on Any nice playbook or tutorial to host a static website from home?

<- View Parent
tofubl@discuss.tchncs.de ⁨1⁩ ⁨week⁩ ago

You can set up your project in a private repo and in your deploy action push it to the main branch of your public Pages repo. I agree it’s not a huge deal to show the source, but I prefer it like that.

name: Deploy Hugo site to Github Pages

on:
  push:
    branches:
      - main
    workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Hugo
        uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: "0.119.0"
          extended: true

      - name: Build
        run: hugo --minify

      - name: Configure Git
        run: |
          git config --global user.email "you@example.com"
          git config --global user.name "Your Name"
      - name: Deploy to GitHub Pages
        env:
          GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
        run: |
          cd public
          git init
          git remote add origin https://user/:${{ secrets.DEPLOY_TOKEN }}@github.com/USER/USER.github.io.git
          git checkout -b main
          git add .
          git commit -m "Deploy site"
          git push -f origin main

source
Sort:hotnewtop