MoreRSS

site iconThe Wandering Allison修改

试图找回自主表达权的普通人。
请复制 RSS 到你的阅读器,或快速订阅到 :

Inoreader Feedly Follow Feedbin Local Reader

The Wandering Allison的 RSS 预览

A Brand New GitHub Pages Each Time

2025-06-14 08:00:00

写点不太需要动脑的东西复健一下。

但我先搞了个英文版的,结果就是完全不想动手再翻回中文……算了,大概解释一下这是干嘛的,反正步骤列的很清楚了(不负责任)。

事情的起因就是,如果使用 GitHub Pages 来 host 静态站点,在没有 GitHub 会员的情况下,这个 GitHub Pages 仓库必须保持公开。那么问题就是,即使拥有自有域名 redirect 到自定义 url,原始仓库依然是公开可见的。每一次的编辑记录只要他人有心,仍然可以翻到。更别提像我原来那样,直接使用 username.github.io,那更是明晃晃地把仓库摆给所有人看了。

这个流程就是试图最大化地减少记录曝光。处理逻辑是这样:


[Local Hugo Source] --> (Push to main) --> [Private GitHub Repo]
 |
 v
 [GitHub Actions Workflow]
 |
 (Build site using Hugo) |
 (Use PAT & force_orphan) v
 -----------------------------------------------------
 | Only /public folder is deployed as new commit |
 | Entire Git history in public repo is replaced |
 -----------------------------------------------------
 |
 v
 [Public GitHub Pages Repo]
 |
 v
 [GitHub Pages Live Website]

用一个私有仓库存放 Hugo 的源码和草稿,另一个公开仓库只放最终生成的静态页面。然后配合 GitHub Actions,每次部署都使用 force_orphan: true 重写整个提交历史,只保留最新一次的结果,这样即使其他人看到静态页面仓库,commit history 也始终只有一条。

最后,为什么我非要起这样一个英文标题,因为构思这个处理流程时,我脑子里一直在自动循环播放 Kodaline 的 Brand New Day,真的很好听呢!


This guide outlines a robust and secure deployment process for a Hugo project to a GitHub Pages repository, ensuring that the commit history is effectively “reset” with each new deployment. This method is particularly useful for keeping sensitive information out of the public repository and maintaining a clean, obfuscated history.

Scenario Overview

The setup involves two distinct GitHub repositories and an automated workflow:

  1. Private Hugo Source Repository: This private repository (github.com/username/hugo-source-repo for example) holds all the Hugo project’s raw source code, including Markdown content, themes, and configuration. Keeping this private ensures sensitive data and work-in-progress remain confidential.
  2. Public GitHub Pages Repository: This public repository serves the live website (e.g., github.com/username/username.github.io for a user/organization page, or github.com/username/project-page for a project page). Importantly, this repository will only contain the static HTML, CSS, JavaScript, and asset files generated by Hugo.
  3. GitHub Actions for Automation: A dedicated GitHub Actions workflow, residing within the private source code repository, automates the deployment. This workflow will:
    • Trigger automatically on pushes to a specified branch (like main).
    • Build the Hugo site, generating the public directory.
    • Take only the contents of this public directory.
    • Deploy these contents to the public GitHub Pages repository.
  4. Clearing Commit History: This is achieved using the peaceiris/actions-gh-pages action with the force_orphan: true flag. This critical setting ensures that each new deployment creates a completely fresh, single commit that effectively replaces the entire history of the GitHub Pages branch. This prevents the accumulation of old commits and makes it difficult to trace past changes, enhancing privacy by design.

This approach efficiently avoids manual history editing and reduces the risk of accidentally exposing sensitive information, as the public repository only ever receives the final, compiled static assets with a completely new history upon each deployment.

Step-by-Step Deployment Guide

Part 1: Set Up GitHub Repositories

  1. Push local Hugo blog project to a private GitHub repository, e.g my-hugo-blog.
  2. Create the Public GitHub Pages Repository:
  • Create a new public repository on GitHub.
  • Crucial Naming:
    • For a User or Organization Page, the repository name must be exactly username.github.io (e.g., johndoe.github.io). GitHub will serve it from the main branch.
    • For a Project Page, it can be named anything (e.g., my-hugo-project-page). GitHub Pages will typically serve it from the gh-pages branch.
  • Create this repository empty, without a README or .gitignore.

Part 2: Configure the Private Hugo Source Repository

  1. Exclude public/ in .gitignore: In the root of the private Hugo source repository, ensure the .gitignore file includes public/. This prevents generated static site files from being committed to the source code.

    # .gitignore
    /public/
    /resources/_gen/
    .hugo_build.lock
    .DS_Store
    
  2. Generate a Personal Access Token (PAT): The GitHub Actions workflow needs permission to push to the public GitHub Pages repository.

    • Go to GitHub’s Settings > Developer settings > Personal access tokens > Tokens (classic)**.
    • Click Generate new token (classic).
    • Give it a clear name (e.g., Hugo_Deploy_PAT).
    • Grant it only the repo scope. This is essential for cross-repository pushes.
    • Copy the generated token immediately! It will not be shown again.
  3. Add the PAT as a Repository Secret:

    • In the private Hugo source repository (e.g., my-hugo-website-source), navigate to Settings > Secrets and variables > Actions.
    • Click New repository secret.
    • Name it DEPLOY_TOKEN.
    • Paste the copied PAT value into the Secret field.
    • Click Add secret.
  4. Create the GitHub Actions Workflow File: Inside the private Hugo source repository, create this file at .github/workflows/deploy.yml.


name: hugo-deploy-CI

# Controls when the action will run. 
on:
 push:
 branches:
 - main # Change this to your source branch
 workflow_dispatch:


jobs:
 # docs:https://github.com/peaceiris/actions-gh-pages
 deploy:
 runs-on: ubuntu-latest
 steps:
 - name: Git checkout
 uses: actions/checkout@v4

 - name: Setup hugo
 uses: peaceiris/actions-hugo@v2
 with:
 hugo-version: '0.81.0'
 extended: true

 - name: Build
 run: hugo

 - name: Deploy to GitHub Pages
 uses: peaceiris/actions-gh-pages@v4
 with: github_token: ${{ secrets.DEPLOY_TOKEN }} # Use the PAT from your repository secrets 
 publish_dir: ./public # The directory containing your built Hugo site
 external_repository: username/username.github.io # IMPORTANT: Your PUBLIC GitHub Pages repo # For a project page, use: username/project-page 
 publish_branch: main # Use 'main' for User/Org Pages, 'gh-pages' for Project Pages 
 force_orphan: true

Key points for this workflow:

  • on: push: branches: - main: Adjust main to the branch where Hugo source code changes are pushed.
  • github_token: ${{ secrets.DEPLOY_TOKEN }}: This securely uses the Personal Access Token.
  • external_repository: username/username.github.io: Crucially, this must be the exact name of the public GitHub Pages repository.
  • publish_branch: main: Ensure this matches the branch configured for GitHub Pages (usually main for user/org pages, gh-pages for project pages).
  • force_orphan: true: This is the setting that replaces the entire branch history with a single new commit on each deployment.

Part 3: Configure the Public GitHub Pages Repository

  1. Set Up GitHub Pages Source:
    • Go to your public GitHub Pages repository on GitHub.
    • Navigate to Settings > Pages.
    • Under “Build and deployment”, select Deploy from a branch for “Source”.
    • For “Branch”, select the appropriate branch and folder:
      • main and / (root) for User/Organization Pages.
      • gh-pages and / (root) for Project Pages.
    • Click Save.

With these steps, every time changes are pushed to the designated deployment branch in the private source repository, GitHub Actions will automatically rebuild the Hugo site and deploy a fresh, clean version with a brand new history to the public GitHub Pages repository.

2025三月读书记录(一)

2025-04-04 08:00:00

随便写写。感觉我失去热情了……

Goodnight Moon

哄睡一只小兔子要多久?

内容简单但细节多多,尤其是无处不在的时钟,仔细看指针就会发现,从这只 bunny 躺到床上到真的可以 “goodnight”,花了这么这么久呢。

The Elephant and the Bad Baby

骂人不好,但真的很想引用豆瓣这个短评:

故事通过极端的夸张与形式化,强调了“请”及附着其上的礼貌的重要性,配上 Briggs 夺人眼目、生动盎然的插画,做到了真正的寓教于乐。那些指责这书三观问题的,大概都是政治正确、一点幽默感也没有的傻逼。

至于豆瓣网友在说谁,点进上面的书籍链接就知。说实话看到所谓的“房间里的大象”的分析我也忍不住翻了个白眼。

妖怪事典

两星。

介绍日本的各种妖怪,对这种书我要求已经很低了,但全是网络内容汇编,海量百度百科原句原段摘抄,谁给你们的勇气出成书?

Little Witch Hazel

Cozy and warm~

讲述森林里的小女巫的一年四季,首尾情节呼应,非常暖心。

以及下面这个画面真的不是在致敬拇指姑娘吗!

Little Witch Hazel

Bird Day

写了笔记

They All Saw a Cat

绘本。正如标题,they all saw a cat! 那都是谁瞧见了呢?各种生灵。这个创作角度很有趣。

image.png|600

The City of Ember

好多年前看过电影,剧情一般但我很喜欢设定:一个地下的微光城市。最近又想起来就找了 audiobook 听。书本身也就是及格分的 YA,情节很多地方过度简化稍微想想就觉得不对,但作者文笔不错,各个角色性格鲜明,而且有声书朗读者表现力十足,声线切换也十分自然,所以忽略设定上的 bug 听起来还是很愉快的。

听完之后去豆瓣翻了下发现我是 09 年看的电影,这片里居然还有罗南,配角阵容也很强大。不过似乎当年扑街得不行。书是系列小说,但电影续集再没有过消息。

Feathers

副标题是 Not Just for Flying。那羽毛都有哪些功能?绘本里选择了各种鸟类不同部位的羽毛来表现。画面漂亮,文字准确,和之前我读过的另外两本 Feathers(分别见 2024十一月读书记录2023读书简报)倒是正好可以互相映证。

Feathers-1.png|600

Feathers-2.png|600

专业退堂鼓表演艺术家的弃文list(之四)

2025-03-25 08:00:00

Naturalist

在 Audible 上听了三小时都还在讲青少年时代,再一看,还有九小时!实在没耐心继续听下去。我对 Edward O. Wilson 是很有兴趣的,但是这个兴趣在于他的科学道路,还是乖乖读他正儿八经的科普书吧,比如《生命的未来》、《蚂蚁的世界》之类。

翦商

阅读进度从 2022 年拖到 2025 年……开头倒是挺吸引人的,但我也只是对商朝的考古遗址以及人祭部分感兴趣而已。

针对这本书的批评相当多,主要就是集中在作者相当主观的对商周文明的推理上,已然是“六经注我”而非“我注六经”了。而让我决定完全放弃的原因是在豆瓣关注过作者一阵子,他对各类事件发表的言论以及使用的标签化词语让我觉得这不是一个我能够信任的、会谨慎使用语言和发表观点的人。后续我会找更严谨严肃的对商朝文化的研究书籍看,不想去费劲思考这书里到底多少是可靠的。

林中水滴

image.png|600

我感兴趣的一位前苏联自然写作者对这位作者很是推崇,随便挑了个微信读书有的版本开读。但碎成这样让人怎么读?每个小标题下都是这些空泛的描写和无谓的抒情,实在太像中学课本上所谓的美文美句,完全忍受不了。

在德黑兰读《洛丽塔》

题材吸引人,伊斯兰革命期间在伊朗共读被禁的《洛丽塔》。问题是,我太讨厌纳博科夫,并没有耐心看对他的文本进行的文本细读。尤其是《洛丽塔》取材自真实犯罪案件,纳博科夫却对此只字不提。他写这篇东西只让我感觉他在炫技,证明他可以用第二语言驾驭花哨的叙述。我从来不能欣赏单纯的文字游戏。没有作者的真心我只会觉得它们一无是处。

另一个非常个人的观感则是,纳博科夫名气太大,因此我不幸在读他的作品之前已经在不同地方读到过他许多访谈和言论,可真是一个尖酸刻薄、自视过高的人。这是我极不喜欢的创作者特质。

枪炮、病菌与钢铁

严格来说我根本还没开始读,但决定把它彻底从我的“或许可以读”列表里划掉。之前已经在一位朋友那边听过对这本书的不喜,可它实在名气太大我想或许也可以读读看?而帮助我完全打消这念头的是前两天听 自然选择 播客,“电子海洛因、科技试验场、影响世界的艺术?以《文明》谈谈游戏”这期提到了这本书,主播说“这本书的作者戴蒙德也许能跟尤瓦尔赫拉利很聊得来(狗头.jpg)”,我秒 get,懂了!播客里有展开聊,此处不再赘述。

醒来的森林

原作名是 Wake Robin,然而作为标题的 robin 都不能得到好好确认的待遇。开篇就是一连串“知更鸟”,拜托,作者都写了“这是原生于美国大陆的鸟”,搞搞清楚,当美国人说 robin,他们指的是 American robin 旅鸫。而英国人口中的 robin 才是知更鸟,aka European robin,aka 欧亚鸲!关于 robin 的更多讨论也可以参考 Reddit 这个

其他鸟类名字也不容乐观。来随机挑个句子。

译文:

假如他模仿得不是那么惟妙惟肖,至少像极了知更鸟、鹪鹩、灰猫嘲鸫、金翼啄木鸟、金翅鸟及歌雀的声音,甚至对“噼噗、噼噗”的那种啼鸣声模仿得十分相像,我认为连歌雀都会信以为真。

原文:

If not fully, and accurately repeated, there are at least suggested the notes of the robin, wren, cat-bird, high-hole, goldfinch, and song-sparrow. The pip, pip of the last is produced so accurately that I verily believe it would deceive the bird herself.

“robin, wren, cat-bird, high-hole, goldfinch, and song-sparrow” 对应的分别应该是旅鸫、鹪鹩、灰嘲鸫、北扑翅䴕、金翅雀、歌带鹀。这像话吗!你是一本写鸟的书!

我读完了第一章“众鸟归来”,错误是从头数到尾。开头连串 robin 就不说了,结尾则是把原文的“pigeon-hawk” 译成“鸽鹰”,“hen-hawk” 省略成“鹰”。别的不说,从作者描述“pigeon-hawk” 飞行模式时所用的词就能看出来,这是典型的隼的特征。Pigeon-hawk 是一个旧日词汇,指的是 merlin 灰背隼,因为它个头很小和鸽子相当。而 hen-hawk 同样是个有年代感的描述,通常指的是 red-tailed hawk 红尾鵟。也就是说,这俩都根本不是鹰!

选择读中文是因为这书写于百年前,我担心用词和现代英语会有隔膜难以理解,但翻了下发现并不难读。中文有好几个版本,除了此处的缪弋译本,另外被评价较多的是程虹版,同样是开头就错译成知更鸟,行了,可以停止了,我还是读原文去吧。

上升的一切必将汇合

微信读书不知什么时候免费塞了这本书给我。奥康纳名气颇大我就点开读了点,开头第一段就让人皱眉头:

玫太太的卧室朝东,窗户低矮。那只公牛就站在窗下,月光将之镀上了一层银辉。它抬着头,似在静听屋内的动静,如一位耐心的神祇,下凡向她求爱。窗内漆黑一片,柔柔娇喘无力传至窗外。

“柔柔娇喘”?我之前没读过奥康纳但也大概知道她的风格,这绝对不像她会用的词。而原文是什么呢?看:

The window was dark and the sound of her breathing too light to be carried outside.

我请问,“柔柔娇喘”是从何而来啊?这还是位女性译者!太荒唐了。不打算再读。

网址及 RSS 变动通知

2025-03-23 08:00:00

网站地址更新为 https://thewanderingallison.vercel.app ,RSS 为 https://thewanderingallison.vercel.app/rss.xml 。旧地址目前仍可访问但不会再同步更新。计划半年后永久下线。

多聊几句变更原因。旧地址墙内可访问,因此时不时有百度、头条、Deepseek 之类来的流量,这实在让我如鲠在喉。并不希望自己的内容被这些平台抓取。而且自从博客图床 变更 后图片实际已经不能在未翻墙的情况下浏览了,索性让文字和图片统一吧。

豆瓣用户黑名单脚本

2025-03-09 08:00:00

人的动力可能不是爱而是恨——当然,说恨有些夸张了,但我就是因为太讨厌某些豆瓣红人并且豆瓣黑名单毫无用处还是总能看到 TA 们到处拉屎以至于忍无可忍自己动手了,尤其是刷读书页面,我造了什么孽要看到某些量子读书的“大 V”们的点评?

这两天上豆瓣还看到很多人转发豆瓣二十年的广播,那我也真是奇怪,二十年了!怎么就没人有这个需求吗!

总之,就是我写了个油猴脚本,可以屏蔽掉这些人在广播、日记下的回复,以及书影音页面的长短评和笔记。

脚本现在勉强达到了给其他人用也能凑合的地步,但还是有很多可改进的地方。怀疑我可能真的有点完美主义的倾向,我又不是专职写这个的,为什么要追求所有功能都达到最好啊?Anyway,还是心一横把它发出来了。

地址: Douban User Blocker

50

2025-03-09 08:00:00

一个庆祝。

本期 BGM(一定要听!):

几年前启用 Neodb 时发现可以创建收藏单并将之设置为阅读目标,每次点进个人页面就会看到进度条,于是大概两年前我立下了一个小小的计划:读 100 本英文书。

今天完成了一半。虽然这 50 本里有 2/3 都是绘本/图像小说,难免有凑数之嫌,可对我来说也是小小的成就了。即使此刻的我觉得我的语言水平还是远远不能达到让自己满意的程度,即使我有时觉得用数字来衡量又难免有些虚荣。

不过看到许多比我不谦虚多了的人在社交媒体洋洋自夸时也忍不住要给自己打气,对自己骄傲一点!但我个人的确是不欣赏过分自信和自夸的人,我也不想成为那样的人。所以只在自己的地盘庆祝一下吧。希望 100 快点到来,当然更希望的是读到的每一本都是享受的。

neodb|600