Skip to content

Commit

Permalink
chore(ci): CNAME: preppend "docs." to homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
litlighilit committed Jan 14, 2025
1 parent 51a8f4b commit ecf890c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ jobs:
- name: "Copy to index.html"
run: cp ${{ env.deploy-dir }}/${{ github.event.repository.name }}.html ${{ env.deploy-dir }}/index.html
- name: "CNAME"
run: echo -n $(echo ${{ github.event.repository.homepage }} | grep -oP 'https?://\K[^/]+') > ${{ env.deploy-dir }}/CNAME
run: |
cname=$(echo ${{ github.event.repository.homepage }} | grep -oP 'https?://\K[^/]+')
prefix="docs."
# py: if cname.startswith(prefix)
# bash: if [[ "${cname}" != $prefix* ]]
if [ ${cname##$prefix} = $cname ]; then
cname="${prefix}${cname}"
fi
echo -n $cname > ${{ env.deploy-dir }}/CNAME
# We must re-build CNAME as we use 'peaceiris/actions-gh-pages@v4',
# where the old dir (including CNAME) will be purged.
- name: Deploy documents
uses: peaceiris/actions-gh-pages@v4
with:
Expand Down

0 comments on commit ecf890c

Please sign in to comment.