GitHub Pages resets custom domain for deployment every time I push to gh-pages

I have a fairly simple static website pipeline with Hugo. The main branch has the code, on each push I run the following GitHub Workflow to generate the website and push it to gh-pages branch. Unfortunately, every time a push happens, the “Custom domain” in “Settings” → “Pages” gets reset to an empty one and my website is deployed to username.github.io/project-name, so I have to get back to this setting every time I push some changes. This is extremely inconvenient, why exactly is this happening? Can I stop it from happening in the future?

Here’s what my Workflow looks like.

name: Build and deploy
on:
  push:
    branches:
      - main
jobs:
  build:
    name: Build & deploy to GitHub Pages
    runs-on: ubuntu-20.04
    steps:

    - name: Check out code
      uses: actions/checkout@v2
      with:
        submodules: recursive
        fetch-depth: 0

    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2
      with:
        hugo-version: 'latest'

    - name: Build website
      run: hugo --minify

    - name: Deploy
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}

Nevermind, I didn’t realize publishing to a custom domain through the settings is just commiting CNAME to gh-pages branch and since I didn’t have static/CNAME in my main branch for Hugo generator, this would be lost after each deployment to gh-pages.